SMX_PGE/sample/SMXSample.cpp

45 lines
913 B
C++
Raw Normal View History

2023-06-16 18:51:30 -05:00
#define OLC_PGE_APPLICATION
#include "olcPixelGameEngine.h"
2023-06-16 19:33:55 -05:00
#include "PGEX_SMX.h"
2023-06-16 18:51:30 -05:00
using namespace olc;
2017-12-14 20:02:36 -06:00
2023-06-16 18:51:30 -05:00
class SMX_PGE : public olc::PixelGameEngine
2017-12-14 20:02:36 -06:00
{
2023-06-16 19:33:55 -05:00
PGEX_SMX smx;
2017-12-14 20:02:36 -06:00
public:
2023-06-16 18:51:30 -05:00
SMX_PGE()
2017-12-14 20:02:36 -06:00
{
2023-06-16 19:33:55 -05:00
sAppName = "SMX PGE";
2017-12-14 20:02:36 -06:00
}
2023-06-16 18:51:30 -05:00
public:
bool OnUserCreate() override
2017-12-14 20:02:36 -06:00
{
2023-06-16 19:33:55 -05:00
SetPixelMode([](const int x,const int y,const Pixel&col,const Pixel&prev){
return col;
});
2023-06-16 18:51:30 -05:00
// Called once at the start, so create things here
return true;
}
2017-12-14 20:02:36 -06:00
2023-06-16 18:51:30 -05:00
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;
2017-12-14 20:02:36 -06:00
}
};
2023-06-16 18:51:30 -05:00
2017-12-14 20:02:36 -06:00
int main()
{
2023-06-16 18:51:30 -05:00
SMX_PGE demo;
2023-06-16 19:33:55 -05:00
if (demo.Construct(12, 21, 50, 50))
2023-06-16 18:51:30 -05:00
demo.Start();
2017-12-14 20:02:36 -06:00
return 0;
}