-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxi_components.h
74 lines (62 loc) · 1.72 KB
/
xi_components.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
64
65
66
67
68
69
70
71
72
73
74
#ifndef XI_COMPONENTS_H
#define XI_COMPONENTS_H
#include "systems.h"
#include "config/project-components.h"
#define STD_COMPONENTS\
POSITION_C,/*v2*/\
FORCES_C,/*v2*/\
BLITABLE_C,/*Blitable*/\
BEHAVIOR_C,/*logic_t*/\
REPEATER_C,/*repeater_t*/\
ANIMATOR_C,/*animator_t*/\
CLICKABLE_C,/*clickable_t*/\
TEXT_C,/*text_node_t*/\
COLLIDER_C,/*v4*/\
SINGLE_RUN_CONTROLLER_C/*uint8_t*/\
#define COMPONENT_SIZES\
sizeof(v2),\
sizeof(v2),\
sizeof(Blitable),\
sizeof(logic_t),\
sizeof(repeater_t),\
sizeof(animator_t),\
sizeof(clickable_t),\
sizeof(text_node_t),\
sizeof(v4),\
sizeof(uint8_t)\
USER_COMPONENT_SIZES
typedef enum COMPONENTS{
STD_COMPONENTS,
USER_COMPONENTS
}COMPONENTS;
typedef struct logic_t{
void (*f)(SYSTEM_ARG_REQUIREMENTS);
}logic_t;
typedef struct repeater_t{
void (*f)(SYSTEM_ARG_REQUIREMENTS);
uint32_t ticks;
uint32_t trigger_time;
uint32_t trigger_count;
uint8_t destroy_after;
}repeater_t;
void repeater_t_init(repeater_t* wrapper, void f(SYSTEM_ARG_REQUIREMENTS), uint32_t interval_time, uint32_t count, uint8_t destroy);
typedef struct clickable_t{
void (*f)(SYSTEM_ARG_REQUIREMENTS);
int32_t recharge_counter;
int32_t recharge_time;
uint8_t toggle;
uint32_t w;
uint32_t h;
}clickable_t;
void clickable_t_init(clickable_t* clicker, void f(SYSTEM_ARG_REQUIREMENTS), int32_t recharge_time, uint32_t w, uint32_t h);
typedef struct text_node_t{
const char* text;
uint8_t red;
uint8_t green;
uint8_t blue;
uint8_t alpha;
}text_node_t;
void text_node_t_init(text_node_t* node, const char* text, uint8_t r, uint8_t g, uint8_t b, uint8_t a);
void text_node_set_text(text_node_t* node, const char* text);
void text_node_set_color(text_node_t* node, uint8_t r, uint8_t g, uint8_t b, uint8_t a);
#endif