diff options
author | Paul Oliver <contact@pauloliver.dev> | 2024-02-29 19:20:22 +0100 |
---|---|---|
committer | Paul Oliver <contact@pauloliver.dev> | 2024-02-29 19:20:52 +0100 |
commit | af7e23ab119eba7c0579796abd288c027edabfa9 (patch) | |
tree | fcd18c9405f33bed0e5f706a8a5d249ee3a63201 /include/Stage.hpp |
Diffstat (limited to 'include/Stage.hpp')
-rw-r--r-- | include/Stage.hpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/include/Stage.hpp b/include/Stage.hpp new file mode 100644 index 0000000..aef99e3 --- /dev/null +++ b/include/Stage.hpp @@ -0,0 +1,44 @@ +#ifndef __STAGE_HPP__ +#define __STAGE_HPP__ + +#include <fstream> +#include <iostream> + +#include <NR_Utils.hpp> +#include <Hyperneat/Utils/Vector.hpp> + +namespace hn = hyperneat; + +class Stage { +public: + int load(const std::string& fileName); + void update(); + void drawOn(sf::RenderWindow& surface) const; + +private: + class CheckPoint { + public: + void calculateSegment(const CheckPoint& prev); + + sf::VertexArray _line = sf::VertexArray(sf::Lines); + double _value = 0.0; + double _segment = 0.0; + b2Body* _body = nullptr; + }; + + b2World _world = { { 0.0f, 0.0f } }; + ContactListener _listener; + + hn::Vector<sf::VertexArray> _walls; + hn::Vector<b2Body*> _wallBodies; + hn::Vector<b2AABB> _traps; + hn::Vector<sf::RectangleShape> _trapRects; + hn::Vector<CheckPoint> _checkPoints; + + sf::CircleShape _factory = sf::CircleShape(AGENT_RAD + 2, AGENT_RES); + + friend class App; + friend class Agent; +}; + +#endif // __STAGE_HPP__ |