2022-03-23 22:01:59 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "../defines.hpp"
|
|
|
|
#include <list>
|
2022-04-23 21:47:16 +02:00
|
|
|
#include <unordered_map>
|
2022-04-23 14:16:02 +02:00
|
|
|
#include "../helpers/AnimatedVariable.hpp"
|
2022-04-23 21:47:16 +02:00
|
|
|
#include "../helpers/BezierCurve.hpp"
|
2023-03-03 13:15:59 +01:00
|
|
|
#include "../helpers/Timer.hpp"
|
2024-04-07 04:31:51 +02:00
|
|
|
#include "eventLoop/EventLoopTimer.hpp"
|
2022-03-23 22:01:59 +01:00
|
|
|
|
2024-03-20 02:44:51 +01:00
|
|
|
class CWindow;
|
|
|
|
|
2022-03-23 22:01:59 +01:00
|
|
|
class CAnimationManager {
|
2022-12-16 18:17:31 +01:00
|
|
|
public:
|
2022-04-23 21:47:16 +02:00
|
|
|
CAnimationManager();
|
|
|
|
|
2023-01-25 16:16:28 +01:00
|
|
|
void tick();
|
2023-08-05 23:29:33 +02:00
|
|
|
bool shouldTickForNext();
|
2023-09-01 22:03:56 +02:00
|
|
|
void onTicked();
|
2023-08-05 23:29:33 +02:00
|
|
|
void scheduleTick();
|
2023-01-25 16:16:28 +01:00
|
|
|
void addBezierWithName(std::string, const Vector2D&, const Vector2D&);
|
|
|
|
void removeAllBeziers();
|
2022-03-23 22:01:59 +01:00
|
|
|
|
2024-04-27 13:43:12 +02:00
|
|
|
void onWindowPostCreateClose(PHLWINDOW, bool close = false);
|
2022-05-14 16:43:30 +02:00
|
|
|
|
2023-01-25 16:16:28 +01:00
|
|
|
bool bezierExists(const std::string&);
|
|
|
|
CBezierCurve* getBezier(const std::string&);
|
2022-08-07 19:28:46 +02:00
|
|
|
|
2023-01-25 16:16:28 +01:00
|
|
|
std::string styleValidInConfigVar(const std::string&, const std::string&);
|
2022-08-07 19:28:46 +02:00
|
|
|
|
2023-01-25 16:16:28 +01:00
|
|
|
std::unordered_map<std::string, CBezierCurve> getAllBeziers();
|
|
|
|
|
2024-03-02 01:35:17 +01:00
|
|
|
std::vector<CBaseAnimatedVariable*> m_vAnimatedVariables;
|
|
|
|
std::vector<CBaseAnimatedVariable*> m_vActiveAnimatedVariables;
|
2022-04-23 14:16:02 +02:00
|
|
|
|
2024-05-05 18:16:00 +02:00
|
|
|
SP<CEventLoopTimer> m_pAnimationTimer;
|
2023-03-02 18:30:47 +01:00
|
|
|
|
2023-03-03 13:15:59 +01:00
|
|
|
float m_fLastTickTime; // in ms
|
|
|
|
|
2022-12-16 18:17:31 +01:00
|
|
|
private:
|
|
|
|
bool deltaSmallToFlip(const Vector2D& a, const Vector2D& b);
|
|
|
|
bool deltaSmallToFlip(const CColor& a, const CColor& b);
|
|
|
|
bool deltaSmallToFlip(const float& a, const float& b);
|
|
|
|
bool deltazero(const Vector2D& a, const Vector2D& b);
|
|
|
|
bool deltazero(const CColor& a, const CColor& b);
|
|
|
|
bool deltazero(const float& a, const float& b);
|
2022-04-23 21:47:16 +02:00
|
|
|
|
|
|
|
std::unordered_map<std::string, CBezierCurve> m_mBezierCurves;
|
2022-05-15 14:18:31 +02:00
|
|
|
|
2023-08-05 23:29:33 +02:00
|
|
|
bool m_bTickScheduled = false;
|
|
|
|
|
2022-05-15 14:18:31 +02:00
|
|
|
// Anim stuff
|
2024-04-27 13:43:12 +02:00
|
|
|
void animationPopin(PHLWINDOW, bool close = false, float minPerc = 0.f);
|
|
|
|
void animationSlide(PHLWINDOW, std::string force = "", bool close = false);
|
2022-03-23 22:01:59 +01:00
|
|
|
};
|
|
|
|
|
2024-03-02 01:35:17 +01:00
|
|
|
inline std::unique_ptr<CAnimationManager> g_pAnimationManager;
|