2018-08-17 20:23:04 +00:00
|
|
|
#ifndef __TRACYBUZZANIM_HPP__
|
|
|
|
#define __TRACYBUZZANIM_HPP__
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
|
|
|
|
namespace tracy
|
|
|
|
{
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
class BuzzAnim
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
bool Match( const T& comp ) const
|
|
|
|
{
|
|
|
|
return active && comp == id;
|
|
|
|
}
|
|
|
|
|
|
|
|
float Time() const
|
|
|
|
{
|
|
|
|
assert( active );
|
|
|
|
return time;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Enable( const T& val, float len )
|
|
|
|
{
|
|
|
|
active = true;
|
|
|
|
time = len;
|
|
|
|
id = val;
|
|
|
|
}
|
|
|
|
|
2022-09-27 22:57:04 +00:00
|
|
|
bool Update( float dt )
|
2018-08-17 20:23:04 +00:00
|
|
|
{
|
|
|
|
if( active )
|
|
|
|
{
|
|
|
|
time -= dt;
|
|
|
|
if( time <= 0 ) active = false;
|
2022-09-27 22:57:04 +00:00
|
|
|
return true;
|
2018-08-17 20:23:04 +00:00
|
|
|
}
|
2022-09-27 22:57:04 +00:00
|
|
|
return false;
|
2018-08-17 20:23:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool active = false;
|
|
|
|
float time;
|
|
|
|
T id;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|