Setup project with SMX linked.
This commit is contained in:
parent
60e84d3f80
commit
5979eddc21
@ -1,27 +1,19 @@
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include "SMX.h"
|
||||
#include <memory>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
#define OLC_PGE_APPLICATION
|
||||
#include "olcPixelGameEngine.h"
|
||||
using namespace olc;
|
||||
|
||||
class InputSample
|
||||
class SMX_PGE : public olc::PixelGameEngine
|
||||
{
|
||||
public:
|
||||
InputSample()
|
||||
SMX_PGE()
|
||||
{
|
||||
// Set a logging callback. This can be called before SMX_Start.
|
||||
// SMX_SetLogCallback( SMXLogCallback );
|
||||
|
||||
// Start scanning. The update callback will be called when devices connect or
|
||||
// disconnect or panels are pressed or released. This callback will be called
|
||||
// from a thread.
|
||||
SMX_Start( SMXStateChangedCallback, this );
|
||||
sAppName = "Example";
|
||||
}
|
||||
|
||||
static void SMXStateChangedCallback(int pad, SMXUpdateCallbackReason reason, void *pUser)
|
||||
{
|
||||
InputSample *pSelf = (InputSample *) pUser;
|
||||
SMX_PGE *pSelf = (SMX_PGE*) pUser;
|
||||
pSelf->SMXStateChanged( pad, reason );
|
||||
}
|
||||
|
||||
@ -36,76 +28,30 @@ public:
|
||||
|
||||
}
|
||||
|
||||
int iPanelToLight = 0;
|
||||
void SetLights()
|
||||
public:
|
||||
bool OnUserCreate() override
|
||||
{
|
||||
string sLightsData;
|
||||
auto addColor = [&sLightsData](uint8_t r, uint8_t g, uint8_t b)
|
||||
{
|
||||
sLightsData.append( 1, r );
|
||||
sLightsData.append( 1, g );
|
||||
sLightsData.append( 1, b );
|
||||
};
|
||||
for( int iPad = 0; iPad < 2; ++iPad )
|
||||
{
|
||||
for( int iPanel = 0; iPanel < 9; ++iPanel )
|
||||
{
|
||||
bool bLight = iPanel == iPanelToLight && iPad == 0;
|
||||
if( !bLight )
|
||||
{
|
||||
// We're not lighting this panel, so append black for the 4x4 and 3x3 lights.
|
||||
for( int iLED = 0; iLED < 25; ++iLED )
|
||||
addColor( 0, 0, 0 );
|
||||
continue;
|
||||
}
|
||||
SMX_Start( SMXStateChangedCallback, this );
|
||||
// Called once at the start, so create things here
|
||||
return true;
|
||||
}
|
||||
|
||||
// Append light data for the outer 4x4 grid of lights.
|
||||
addColor( 0xFF, 0, 0 );
|
||||
addColor( 0xFF, 0, 0 );
|
||||
addColor( 0xFF, 0, 0 );
|
||||
addColor( 0xFF, 0, 0 );
|
||||
addColor( 0, 0xFF, 0 );
|
||||
addColor( 0, 0xFF, 0 );
|
||||
addColor( 0, 0xFF, 0 );
|
||||
addColor( 0, 0xFF, 0 );
|
||||
addColor( 0, 0, 0xFF );
|
||||
addColor( 0, 0, 0xFF );
|
||||
addColor( 0, 0, 0xFF );
|
||||
addColor( 0, 0, 0xFF );
|
||||
addColor( 0xFF, 0xFF, 0 );
|
||||
addColor( 0xFF, 0xFF, 0 );
|
||||
addColor( 0xFF, 0xFF, 0 );
|
||||
addColor( 0xFF, 0xFF, 0 );
|
||||
|
||||
// Append light data for the inner 3x3 grid of lights, if present. These
|
||||
// are ignored if the platform doesn't have them.
|
||||
addColor( 0xFF, 0, 0 );
|
||||
addColor( 0xFF, 0, 0 );
|
||||
addColor( 0xFF, 0, 0 );
|
||||
addColor( 0, 0xFF, 0 );
|
||||
addColor( 0, 0xFF, 0 );
|
||||
addColor( 0, 0xFF, 0 );
|
||||
addColor( 0, 0, 0xFF );
|
||||
addColor( 0, 0, 0xFF );
|
||||
addColor( 0, 0, 0xFF );
|
||||
}
|
||||
}
|
||||
|
||||
SMX_SetLights2( sLightsData.data(), sLightsData.size() );
|
||||
bool OnUserUpdate(float fElapsedTime) override
|
||||
{
|
||||
// called once per frame
|
||||
for (int x = 0; x < ScreenWidth(); x++)
|
||||
for (int y = 0; y < ScreenHeight(); y++)
|
||||
Draw(x, y, olc::Pixel(rand() % 255, rand() % 255, rand()% 255));
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
InputSample demo;
|
||||
|
||||
// Loop forever for this sample.
|
||||
while(1)
|
||||
{
|
||||
Sleep(500);
|
||||
demo.SetLights();
|
||||
}
|
||||
SMX_PGE demo;
|
||||
if (demo.Construct(256, 240, 4, 4))
|
||||
demo.Start();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -14,20 +14,20 @@
|
||||
<ProjectGuid>{8861D665-FD49-4EFD-92C3-F4B8548AFD23}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>SMXSample</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
<ProjectName>SMXSample</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
@ -62,6 +62,7 @@
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<DisableSpecificWarnings>4063;4100;4127;4201;4244;4275;4355;4505;4512;4702;4786;4996;4996;4005;4018;4389;4389;4800;4592;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<AdditionalIncludeDirectories>..\sdk</AdditionalIncludeDirectories>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
@ -80,6 +81,7 @@
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<DisableSpecificWarnings>4063;4100;4127;4201;4244;4275;4355;4505;4512;4702;4786;4996;4996;4005;4018;4389;4389;4800;4592;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<AdditionalIncludeDirectories>..\sdk</AdditionalIncludeDirectories>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
@ -97,6 +99,9 @@
|
||||
<Project>{c5fc0823-9896-4b7c-bfe1-b60db671a462}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="olcPixelGameEngine.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
|
@ -5,10 +5,18 @@
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{4453342b-4238-49ad-8412-9602572b054a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="SMXSample.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="olcPixelGameEngine.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
6695
sample/olcPixelGameEngine.h
Normal file
6695
sample/olcPixelGameEngine.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -45,19 +45,19 @@
|
||||
<ProjectGuid>{C5FC0823-9896-4B7C-BFE1-B60DB671A462}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>SMX</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include <windows.h>
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
using namespace std;
|
||||
using namespace SMX;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user