1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- #ifndef GAME_H
- #define GAME_H
- #include <vector>
- #include <deque>
- #include "input/Keys.h"
- #include "rendering/Renderer.h"
- class Game final {
- public:
- Game(Keys& control);
- void tick();
- void render(float lag, Renderer& renderer) const;
- bool isRunning() const;
- private:
- struct Point {
- bool operator<(const Point& other);
- float x;
- float y;
- };
-
- bool isLowerTangent(const Point& a, const Point& b, const std::vector<Point>& hull) const;
- bool isUpperTangent(const Point& a, const Point& b, const std::vector<Point>& hull) const;
-
- void findLowerTangent(const std::vector<Point>& hullA, const std::vector<Point>& hullB, int& a, int& b) const;
- void findUpperTangent(const std::vector<Point>& hullA, const std::vector<Point>& hullB, int& a, int& b) const;
-
- int findMaxX(const std::vector<Point>& hull) const;
- int findMinX(const std::vector<Point>& hull) const;
-
- void split();
-
- float det(const Point& a, const Point& b, const Point& c) const;
- void merge();
- Keys& keys;
- int keyNext;
-
- std::vector<Point> data;
- std::vector<Point> convexHull;
-
- int active;
- std::deque<std::vector<Point>> groups[2];
- };
- #endif
|