diff options
author | Paul Oliver <contact@pauloliver.dev> | 2024-02-29 19:27:35 +0100 |
---|---|---|
committer | Paul Oliver <contact@pauloliver.dev> | 2024-02-29 19:27:49 +0100 |
commit | 17909d029c6a8872b2fddf4e171d7925bbbe9c5c (patch) | |
tree | cbb08af84cd68d24acc362d593a2048b0fa79689 /Simulation/SimBase.hpp |
Diffstat (limited to 'Simulation/SimBase.hpp')
-rw-r--r-- | Simulation/SimBase.hpp | 70 |
1 files changed, 70 insertions, 0 deletions
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 <fstream> +#include <list> + +#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<Zapper> zappers; + std::list<Pellet> pellets; + std::list<Guppie> guppies; + std::list<Corpse> 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__ |