-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheffect.h
63 lines (50 loc) · 1.08 KB
/
effect.h
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#ifndef EFFECT_H
#define EFFECT_H
typedef enum EffectType
{
EFFECT_BREATHE,
EFFECT_RAINBOW
} EffectType;
typedef struct EffectBreathe_
{
EffectType type;
float rate;
float min;
float max;
float current_time;
} EffectBreathe;
typedef struct EffectRainbow_
{
EffectType type;
float rate;
unsigned char alpha;
float current_time;
} EffectRainbow;
typedef union Effect_
{
EffectType type;
EffectBreathe breathe;
EffectRainbow rainbow;
} Effect;
void update_effect(Effect* effect, void* out);
void get_effect(Effect* effect, void* in_data, void* out_data);
static inline Effect create_effect_breathe(float min, float max, float rate)
{
Effect effect;
effect.breathe.type = EFFECT_BREATHE;
effect.breathe.min = min;
effect.breathe.max = max;
effect.breathe.rate = rate;
effect.breathe.current_time = 0.0f;
return effect;
}
static inline Effect create_effect_rainbow(float rate, unsigned char alpha)
{
Effect effect;
effect.rainbow.type = EFFECT_RAINBOW;
effect.rainbow.rate = rate;
effect.rainbow.current_time = 0.0f;
effect.rainbow.alpha = alpha;
return effect;
}
#endif