Facebook
From Bistre Tortoise, 4 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 146
  1. #define OLC_PGE_APPLICATION
  2. #include "olcPixelGameEngine.h"
  3.  
  4. // Override base class with your custom functionality
  5. class Example : public olc::PixelGameEngine
  6. {
  7. public:
  8.         Example()
  9.         {
  10.                 // Name you application
  11.                 sAppName = "Example";
  12.         }
  13.  
  14. public:
  15.         bool OnUserCreate() override
  16.         {
  17.                 // Called once at the start, so create things here
  18.                 return true;
  19.         }
  20.  
  21.         bool OnUserUpdate(float fElapsedTime) override
  22.         {
  23.                 // called once per frame, draws random coloured pixels
  24.                 for (int x = 0; x < ScreenWidth(); x++)
  25.                         for (int y = 0; y < ScreenHeight(); y++)
  26.                                 Draw(x, y, olc::Pixel(rand() % 256, rand() % 256, rand() % 256));
  27.                 return true;
  28.         }
  29. };