From 17909d029c6a8872b2fddf4e171d7925bbbe9c5c Mon Sep 17 00:00:00 2001 From: Paul Oliver Date: Thu, 29 Feb 2024 19:27:35 +0100 Subject: Initial commit --- Simulation/SimBase.hpp | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 Simulation/SimBase.hpp (limited to 'Simulation/SimBase.hpp') diff --git a/Simulation/SimBase.hpp b/Simulation/SimBase.hpp new file mode 100644 index 0000000..83e7f4c --- /dev/null +++ b/Simulation/SimBase.hpp @@ -0,0 +1,70 @@ +#ifndef __SIMBASE_HPP__ +#define __SIMBASE_HPP__ + +//#include +#include + +#include "Params.hpp" +#include "GraphicObjs.hpp" + +#include "Camera.hpp" +#include "Tank.hpp" +#include "TextDisplay.hpp" +#include "Zapper.hpp" +#include "Pellet.hpp" +#include "Guppie.hpp" +#include "Corpse.hpp" + +class SimBase : public GraphicObjs +{ +public: + bool createNew(const Params &usrPrms); + //bool load(const std::ifstream &file); + void execute(); + +protected: + void prepareGraphics(); + void update(); + void draw(); + + virtual bool startSpecs() = 0; + virtual void updateSpecs() = 0; + //void onClose(); + + Params prms; + sf::RenderWindow window; + Camera camera; + Tank tank; + TextDisplay text; + + sf::Clock timer; + unsigned frameCounter = 0; + + bool paused = false; + bool gfx = true; + bool displayText = true; + bool vSync = true; + bool fullscreen = false; + unsigned step = 0; + + unsigned pelletCount = 0; + unsigned guppieCount = 0; + unsigned corpseCount = 0; + + std::list zappers; + std::list pellets; + std::list guppies; + std::list corpses; + + friend class Camera; + friend class Tank; + friend class ContactListener; + friend class TextDisplay; + friend class Entity; + friend class Zapper; + friend class Pellet; + friend class Corpse; + friend class Guppie; +}; + +#endif // __SIMBASE_HPP__ -- cgit v1.2.1