Create ExampleProgram.cpp
This commit is contained in:
parent
1cb80fc6f9
commit
62ef142a6e
36
ExampleProgram.cpp
Normal file
36
ExampleProgram.cpp
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
#include "olcPixelGameEngine.h"
|
||||||
|
|
||||||
|
class Example : public olc::PixelGameEngine
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Example()
|
||||||
|
{
|
||||||
|
sAppName = "Example";
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
bool OnUserCreate() override
|
||||||
|
{
|
||||||
|
// 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()
|
||||||
|
{
|
||||||
|
Example demo;
|
||||||
|
if (demo.Construct(256, 240, 4, 4))
|
||||||
|
demo.Start();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user