blob: fa3151d3312e913eb63e8f5b9120449097d1ed2d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#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;
}
void Update( float dt )
{
if( active )
{
time -= dt;
if( time <= 0 ) active = false;
}
}
private:
bool active = false;
float time;
T id;
};
}
#endif
|