You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
SMX_PGE/sample/SMXSample.cpp

57 lines
1.2 KiB

#include "SMX.h"
#define OLC_PGE_APPLICATION
#include "olcPixelGameEngine.h"
using namespace olc;
class SMX_PGE : public olc::PixelGameEngine
{
public:
SMX_PGE()
{
sAppName = "Example";
}
static void SMXStateChangedCallback(int pad, SMXUpdateCallbackReason reason, void *pUser)
{
SMX_PGE *pSelf = (SMX_PGE*) pUser;
pSelf->SMXStateChanged( pad, reason );
}
static void SMXLogCallback(const char *log)
{
printf("-> %s\n", log);
}
void SMXStateChanged(int pad, SMXUpdateCallbackReason reason)
{
printf("Device %i state changed: %04x\n", pad, SMX_GetInputState(pad));
}
public:
bool OnUserCreate() override
{
SMX_Start( SMXStateChangedCallback, this );
// Called once at the start, so create things here
return true;
}
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()
{
SMX_PGE demo;
if (demo.Construct(256, 240, 4, 4))
demo.Start();
return 0;
}