From 62ef142a6e60136160bc3989725812f44fcbf0a9 Mon Sep 17 00:00:00 2001 From: Javidx9 <25419386+OneLoneCoder@users.noreply.github.com> Date: Fri, 7 Sep 2018 20:57:21 +0100 Subject: [PATCH] Create ExampleProgram.cpp --- ExampleProgram.cpp | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 ExampleProgram.cpp diff --git a/ExampleProgram.cpp b/ExampleProgram.cpp new file mode 100644 index 0000000..2f1dc48 --- /dev/null +++ b/ExampleProgram.cpp @@ -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; +}