aboutsummaryrefslogtreecommitdiff
path: root/Simulation/SimBase.hpp
blob: 83e7f4c823c25194785db90673124da9ee370b4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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__