#define OLC_PGE_APPLICATION #include "olcPixelGameEngine.h" // Override base class with your custom functionality class CircleExample : public olc::PixelGameEngine { struct Circle{ Circle(olc::vf2d pos,float radius) :pos(pos),radius(radius){ std::cout<<"Circle created!"<circles; }; public: CircleExample() { // Name your application sAppName = "Circles Example"; } std::vectorcircleList; std::vectorcircleGroupList; public: bool OnUserCreate() override { // Called once at the start, so create things here for(int y=0;y<5;y++){ for(int x=0;x<5;x++){ Circle myCircle = {olc::vf2d{x*16.f,y*16.f},8}; circleList.push_back(myCircle); } } CircleGroup myGroup; myGroup.circles.push_back(&circleList[3]); myGroup.circles.push_back(&circleList[4]); myGroup.circles.push_back(&circleList[9]); circleGroupList.push_back(myGroup); for(CircleGroup&circleGroup : circleGroupList){ for(Circle*c : circleGroup.circles){ c->pos+={20,0}; } } return true; } bool OnUserUpdate(float fElapsedTime) override { // Called once per frame, draws random coloured pixels Clear(olc::VERY_DARK_GREEN); olc::vf2d drawOffset = {64,64}; for(Circle&c : circleList){ DrawCircle(c.pos+drawOffset,c.radius); } for(CircleGroup&circleGroup : circleGroupList){ for(Circle*c : circleGroup.circles){ DrawCircle(c->pos+drawOffset,c->radius,olc::RED); } } return true; } }; int main() { CircleExample demo; if (demo.Construct(256, 240, 4, 4)) demo.Start(); return 0; }