3gui_init :: () {
5}
8gui_draw_screen :: () {
9 using container;
10 x = (GetScreenWidth() / 2.0) - (WIDTH / 2.0);
11 y = GetScreenHeight() - HEIGHT;
12 width = WIDTH;
13 height = HEIGHT;
15 left := rcut_from_left(*container, 0.333333);
16 mid := rcut_from_left(*container, 0.5);
17 right := rcut_from_left(*container, 1.0);
19 SIZE :: 30.0;
21 draw_indicator(left, .TRAD_TREE);
22 draw_indicator(mid, .HYPER_TREE);
23 draw_indicator(right, .CELLS);
25 draw_text(left, "vTree", SIZE, .TRAD_TREE);
26 draw_text(mid, "hTree", SIZE, .HYPER_TREE);
27 draw_text(right, "Cells", SIZE, .CELLS);
28}
30gui_statistics :: (st: *Statistics) {
31 FONT_SIZE :: 20;
33 using st;
34 total = nodes + children + empty;
36 stats := tprint("Nodes: %1 | Children: %2 | Empty: %3 | Total: %4",
37 nodes,
38 children,
39 empty,
40 total
41 );
43 info := to_c_string(stats);
44 DrawText(
45 info,
46 SCREEN_WIDTH - MeasureText(info, FONT_SIZE) - 16,
47 SCREEN_HEIGHT - 24,
48 FONT_SIZE,
49 { 160, 160, 200, 220 }
50 );
52}
55#scope_file
58container: Rectangle;
61WIDTH :: 420.0;
62HEIGHT :: 60.0;
65draw_text :: (rect: Rectangle, text: string, size: float, m: Mode) {
66 color := ifx mode == m then COLOR_BACKGROUND else WHITE;
68 ctext := to_c_string(text);
69 mt := MeasureTextEx(GetFontDefault(), ctext, size, 1.0);
71 x := rect.x + (rect.width / 2.0) - (mt.x / 2.0) - 3.0;
72 y := rect.y + (rect.height / 2.0) - (mt.y / 2.0);
74 DrawText(ctext, xx x, xx y, xx size, color);
75}
77draw_indicator :: (rect: Rectangle, m: Mode) {
78 if mode == m
79 then DrawRectangleRec(rect, WHITE);
80 else DrawRectangleLinesEx(rect, 1.0, WHITE);
81}
index : binary-tree
---