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
|
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#define ENGINE_INTERNALS
#include <engine/engine.h>
#include <engine/rendering.h>
extern Platform* GLOBAL_PLATFORM;
extern const char* uitype_str[];
void render_uitree(Window* w, UITree* t) {
switch (t->type) {
case uitype_container:
render_container(w, &t->container);
break;
case uitype_button:
render_button(w, &t->button);
break;
case uitype_title:
render_title(w, &t->title);
break;
case uitype_text:
render_text(w, &t->text);
break;
default:
if (t->type >= uitype_MAX) {
ERROR("Unknown uitype: %d", t->type);
} else {
WARN("Rendering not implemented for %s", uitype_str[t->type]);
}
break;
}
}
void render_container(Window* w, UITree_container* t) {
if (t->children != NULL && t->children_len > 0) {
for (usize i = 0; i < t->children_len; i++) {
render_uitree(w, t->children[i]);
}
}
}
void render_button(Window* w, UITree_button* t) {
}
void render_title(Window* w, UITree_title* t) {
}
void render_text(Window* w, UITree_text* t) {
}
i64 add_texture(struct Resources* resptr, Texture* t) {
return 0;
}
i64 engine_render_text(i32 font_id, Engine_color fg, char* text,
v2_i32* size_out, bool wrapped) {
return 0;
}
|