summaryrefslogtreecommitdiffhomepage
path: root/src/main.c
blob: 5d3798556fb534c9449d1c71e828a14120a4c908 (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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130

#include "rodeo.h"

Rodeo__data_p state;

const Rodeo__color_rgba_t red =
{
	1.0f, 0.0f, 0.0f,
	1.0f
};
const Rodeo__color_rgba_t green =
{
	0.0f, 1.0f, 0.0f,
	1.0f
};
const Rodeo__color_rgba_t blue =
{
	0.0f, 0.0f, 1.0f,
	1.0f
};
const Rodeo__color_rgba_t pink =
{
	1.0f, 0.0f, 1.0f,
	1.0f
};

const Rodeo__color_rgba_t red_clear =
{
	1.0f, 0.0f, 0.0f,
	0.5f
};
const Rodeo__color_rgba_t green_clear =
{
	0.0f, 1.0f, 0.0f,
	0.5f
};
const Rodeo__color_rgba_t blue_clear =
{
	0.0f, 0.0f, 1.0f,
	0.5f
};
const Rodeo__color_rgba_t pink_clear =
{
	1.0f, 0.0f, 1.0f,
	0.5f
};

void
main_loop(void)
{
	Rodeo__begin(state);

	//printf("%s\n", 				Rodeo__get_renderer_name_as_string());

	   Rodeo__draw_rectangle(
	   state,
	   100, 100,
	   50, 50,
	   red
	   );
	   Rodeo__draw_rectangle(
	   state,
	   100, 160,
	   50, 50,
	   green
	   );
	   Rodeo__draw_rectangle(
	   state,
	   160, 100,
	   50, 50,
	   blue
	   );
	   Rodeo__draw_rectangle(
	   state,
	   160, 160,
	   50, 50,
	   pink
	   );

	   Rodeo__draw_rectangle(
	   state,
	   300, 300,
	   50, 50,
	   red_clear
	   );
	   Rodeo__draw_rectangle(
	   state,
	   310, 310,
	   50, 50,
	   green_clear
	   );
	   Rodeo__draw_rectangle(
	   state,
	   320, 320,
	   50, 50,
	   blue_clear
	   );
	   Rodeo__draw_rectangle(
	   state,
	   330, 330,
	   50, 50,
	   pink_clear
	   );

	Rodeo__draw_debug_text(
			1,
			1,
			" using %s renderer ",
			Rodeo__get_renderer_name_as_string()
			);

	Rodeo__end(state);
}

int
main()
{
	printf("Init window...\n");
	Rodeo__init_window(&state, 480, 640, "Rodeo Window");
	printf("done creating window\n");

	Rodeo__execute_main_loop(
		state,
		main_loop
	);

	Rodeo__deinit_window(state);
	Rodeo__quit();
	return 0;
}