summaryrefslogtreecommitdiffhomepage
path: root/include/rodeo.h
blob: 713e2609525e47e3ac89e3953234149d6ebc55b1 (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
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110

// public internal
#include "rodeo_types.h"

// system
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <limits.h>

#define mrodeo_name_concat(prefix, suffix) prefix##suffix
#define mrodeo_macrovar(prefix) mrodeo_name_concat(prefix##_, __LINE__)

#define mrodeo_defer_do(start, end) for(				\
		int mrodeo_macrovar(_macrovar_) = (start, 0);	\
		!mrodeo_macrovar(_macrovar_);					\
		(mrodeo_macrovar(_macrovar_) += 1), end)			\

#define								\
mrodeo_window_do(					\
	state,							\
	screen_height,					\
	screen_width,					\
	title							\
)									\
	mrodeo_defer_do(				\
		rodeo_window_init(			\
			&state,					\
			screen_height,			\
			screen_width,			\
			title					\
		),							\
		rodeo_window_deinit(state)	\
	)

void
rodeo_\
window_init(
	rodeo_data_p *state,
	int screen_height,
	int screen_width,
	char* title
);

void
rodeo_\
window_deinit(rodeo_data_p state);

void
rodeo_\
deinit(void);

#define						\
mrodeo_do(					\
	state					\
)							\
	mrodeo_defer_do(		\
		rodeo_begin(state),	\
		rodeo_end(state)	\
	)

void
rodeo_\
begin(rodeo_data_p state);

void
rodeo_\
end(rodeo_data_p state);

void
rodeo_\
mainloop_set(
	rodeo_data_p state,
	rodeo_mainloop_func main_loop_function
);

bool
rodeo_\
window_check_quit(rodeo_data_p state);

void
rodeo_\
set_quit(rodeo_data_p state, bool quit);

void
rodeo_\
debug_text_draw(uint16_t x, uint16_t y, const char *format, ...);

// rodeo_renderer_name_get
const char *
rodeo_\
renderer_name_get(void);

// rodeo_renderer_flush
void
rodeo_\
renderer_flush(rodeo_data_p state);

// rodeo_rectangle_draw
void
rodeo_\
rectangle_draw(
	rodeo_data_p state,
	uint16_t x,
	uint16_t y,
	uint16_t width,
	uint16_t height,
	rodeo_rgba_t color
);