2023-05-23 23:38:37 +02:00
|
|
|
#ifndef HOLESOME_TRACKING_VIEW_H
|
|
|
|
#define HOLESOME_TRACKING_VIEW_H
|
2023-05-09 20:50:50 +02:00
|
|
|
|
|
|
|
|
|
|
|
#include "../game_object.h"
|
2023-05-14 22:23:25 +02:00
|
|
|
#include "ITrackable.h"
|
|
|
|
#include "../../primitives/circle_object.h"
|
2023-05-09 20:50:50 +02:00
|
|
|
|
2023-05-24 14:00:51 +02:00
|
|
|
class CircleObject;
|
|
|
|
|
2023-05-23 23:38:37 +02:00
|
|
|
class TrackingView : public GameObject
|
2023-05-09 20:50:50 +02:00
|
|
|
{
|
|
|
|
public:
|
2023-05-24 01:15:05 +02:00
|
|
|
explicit TrackingView(float freeMoveRadius = 150,
|
|
|
|
float dynamicFollowRadius = 300);
|
2023-05-09 20:50:50 +02:00
|
|
|
|
2023-05-23 23:38:37 +02:00
|
|
|
~TrackingView();
|
2023-05-09 20:50:50 +02:00
|
|
|
|
2023-05-14 22:23:25 +02:00
|
|
|
|
2023-05-09 20:50:50 +02:00
|
|
|
void draw(sf::RenderWindow *window) const override;
|
2023-05-24 14:00:51 +02:00
|
|
|
|
|
|
|
void lateUpdate() override;
|
2023-05-09 20:50:50 +02:00
|
|
|
|
2023-05-24 01:15:05 +02:00
|
|
|
void addTrackable(ITrackable *trackable);
|
|
|
|
|
2023-05-14 22:23:25 +02:00
|
|
|
sf::Vector2f getSize() const;
|
2023-05-24 14:00:51 +02:00
|
|
|
|
2023-05-14 22:23:25 +02:00
|
|
|
sf::Vector2f getCenter() const;
|
2023-05-09 20:50:50 +02:00
|
|
|
|
|
|
|
private:
|
2023-05-14 22:23:25 +02:00
|
|
|
sf::View *view{};
|
|
|
|
bool hasViewChanged{};
|
2023-05-24 01:15:05 +02:00
|
|
|
float freeMoveRadius;
|
|
|
|
float dynamicFollowRadius;
|
|
|
|
std::vector<ITrackable *> trackables;
|
2023-05-14 22:23:25 +02:00
|
|
|
|
|
|
|
CircleObject *marker;
|
2023-05-10 11:03:14 +02:00
|
|
|
|
2023-05-24 14:00:51 +02:00
|
|
|
void initializeView();
|
2023-05-10 11:30:11 +02:00
|
|
|
|
|
|
|
void setSize(sf::Vector2u windowSize);
|
|
|
|
|
2023-05-14 22:23:25 +02:00
|
|
|
void followTarget();
|
|
|
|
|
|
|
|
void moveCenter(sf::Vector2<float> delta);
|
|
|
|
|
2023-05-24 01:15:05 +02:00
|
|
|
sf::Vector2f getCollectiveTrackingPoint() const;
|
|
|
|
|
|
|
|
void processTrackableStates();
|
2023-05-09 20:50:50 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2023-05-23 23:38:37 +02:00
|
|
|
#endif //HOLESOME_TRACKING_VIEW_H
|