comparison examples/example-gridmenu/example-gridmenu.c @ 469:0d6206cee6b9

core: state -> mlk_state
author David Demelier <markand@malikania.fr>
date Mon, 27 Feb 2023 11:11:23 +0100
parents 01f5580e43d1
children 02b16dd49b54
comparison
equal deleted inserted replaced
468:91ce23a36143 469:0d6206cee6b9
34 #include <mlk/ui/ui.h> 34 #include <mlk/ui/ui.h>
35 35
36 #define W (1280) 36 #define W (1280)
37 #define H (720) 37 #define H (720)
38 38
39 static struct state *states[1]; 39 static struct mlk_state *states[1];
40 40
41 static void 41 static void
42 init(void) 42 init(void)
43 { 43 {
44 if (mlk_core_init("fr.malikania", "example-gridmenu") < 0 || ui_init() < 0) 44 if (mlk_core_init("fr.malikania", "example-gridmenu") < 0 || ui_init() < 0)
54 ui_finish(); 54 ui_finish();
55 mlk_core_finish(); 55 mlk_core_finish();
56 } 56 }
57 57
58 static void 58 static void
59 handle(struct state *st, const union mlk_event *ev) 59 handle(struct mlk_state *st, const union mlk_event *ev)
60 { 60 {
61 struct gridmenu *menu = st->data; 61 struct gridmenu *menu = st->data;
62 62
63 switch (ev->type) { 63 switch (ev->type) {
64 case MLK_EVENT_QUIT: 64 case MLK_EVENT_QUIT:
70 break; 70 break;
71 } 71 }
72 } 72 }
73 73
74 static void 74 static void
75 draw(struct state *st) 75 draw(struct mlk_state *st)
76 { 76 {
77 mlk_painter_set_color(0x4f8fbaff); 77 mlk_painter_set_color(0x4f8fbaff);
78 mlk_painter_clear(); 78 mlk_painter_clear();
79 gridmenu_draw(st->data); 79 gridmenu_draw(st->data);
80 mlk_painter_present(); 80 mlk_painter_present();
102 "Résurrection", 102 "Résurrection",
103 "Double tour" 103 "Double tour"
104 }; 104 };
105 105
106 struct gridmenu menu = {0}; 106 struct gridmenu menu = {0};
107 struct state state = { 107 struct mlk_state state = {
108 .data = &menu, 108 .data = &menu,
109 .handle = handle, 109 .handle = handle,
110 .draw = draw, 110 .draw = draw,
111 }; 111 };
112 112