65 lines
1.7 KiB
C++
65 lines
1.7 KiB
C++
#pragma once
|
|
|
|
#include "IAnimationManager.h"
|
|
#include "IEngine.h"
|
|
|
|
|
|
class AnimationManager
|
|
: public IAnimationManager
|
|
{
|
|
public:
|
|
AnimationManager(IEngine& argEngine);
|
|
virtual ~AnimationManager();
|
|
|
|
virtual void AddDemoTimeAnimation(double argBeginTime, double argEndTime, IAnimateable* argValue, unsigned int argUserData = 0);
|
|
virtual void AddRealTimeAnimation(double argBeginTime, double argEndTime, IAnimateable* argValue, unsigned int argUserData = 0);
|
|
|
|
virtual void AddDemoTimeEvent(double argTime, IEvent* argValue, unsigned int argUserData = 0);
|
|
virtual void AddRealTimeEvent(double argTime, IEvent* argValue, unsigned int argUserData = 0);
|
|
|
|
virtual void Animate();
|
|
|
|
private:
|
|
struct r_AnimationInterval
|
|
{
|
|
r_AnimationInterval(double argBegin, double argEnd)
|
|
: m_Begin(argBegin)
|
|
, m_End(argEnd)
|
|
{
|
|
};
|
|
|
|
double m_Begin;
|
|
double m_End;
|
|
};
|
|
|
|
struct r_ForwardSort
|
|
{
|
|
bool operator ()(const r_AnimationInterval& a, const r_AnimationInterval& b) const
|
|
{
|
|
return a.m_Begin < b.m_Begin;
|
|
}
|
|
};
|
|
|
|
struct r_BackwardSort
|
|
{
|
|
bool operator ()(const r_AnimationInterval& a, const r_AnimationInterval& b) const
|
|
{
|
|
return a.m_End > b.m_End;
|
|
}
|
|
};
|
|
|
|
typedef std::map<r_AnimationInterval, std::vector<std::pair<IAnimateable*, unsigned int> >, r_ForwardSort> tk_ForwardAnims;
|
|
typedef std::map<r_AnimationInterval, std::vector<std::pair<IAnimateable*, unsigned int> >, r_BackwardSort> tk_BackwardAnims;
|
|
typedef std::map<double, std::vector<std::pair<IEvent*, unsigned int> > > tk_Events;
|
|
|
|
IEngine& m_Engine;
|
|
tk_ForwardAnims m_ForwardSortedAnimations;
|
|
tk_BackwardAnims m_BackwardSortedAnimations;
|
|
tk_ForwardAnims m_RealTimeAnimations;
|
|
tk_Events m_DemoTimeEvents;
|
|
tk_Events m_RealTimeEvents;
|
|
|
|
double m_PreviousDemoTime;
|
|
double m_PreviousRealTime;
|
|
};
|