Mercurial > molko
comparison examples/example-notify/example-notify.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 | bc5483849614 |
comparison
equal
deleted
inserted
replaced
468:91ce23a36143 | 469:0d6206cee6b9 |
---|---|
44 .x = 10, | 44 .x = 10, |
45 .y = 10, | 45 .y = 10, |
46 .flags = LABEL_FLAGS_SHADOW | 46 .flags = LABEL_FLAGS_SHADOW |
47 }; | 47 }; |
48 static struct texture icon; | 48 static struct texture icon; |
49 static struct state *states[1]; | 49 static struct mlk_state *states[1]; |
50 | 50 |
51 static void | 51 static void |
52 init(void) | 52 init(void) |
53 { | 53 { |
54 if (mlk_core_init("fr.malikania", "example-notify") < 0 || ui_init() < 0) | 54 if (mlk_core_init("fr.malikania", "example-notify") < 0 || ui_init() < 0) |
58 if (mlk_image_openmem(&icon, assets_images_sword, sizeof (assets_images_sword)) < 0) | 58 if (mlk_image_openmem(&icon, assets_images_sword, sizeof (assets_images_sword)) < 0) |
59 mlk_panic(); | 59 mlk_panic(); |
60 } | 60 } |
61 | 61 |
62 static void | 62 static void |
63 handle(struct state *st, const union mlk_event *ev) | 63 handle(struct mlk_state *st, const union mlk_event *ev) |
64 { | 64 { |
65 (void)st; | 65 (void)st; |
66 | 66 |
67 switch (ev->type) { | 67 switch (ev->type) { |
68 case MLK_EVENT_QUIT: | 68 case MLK_EVENT_QUIT: |
76 break; | 76 break; |
77 } | 77 } |
78 } | 78 } |
79 | 79 |
80 static void | 80 static void |
81 update(struct state *st, unsigned int ticks) | 81 update(struct mlk_state *st, unsigned int ticks) |
82 { | 82 { |
83 (void)st; | 83 (void)st; |
84 | 84 |
85 notify_update(ticks); | 85 notify_update(ticks); |
86 } | 86 } |
87 | 87 |
88 static void | 88 static void |
89 draw(struct state *st) | 89 draw(struct mlk_state *st) |
90 { | 90 { |
91 (void)st; | 91 (void)st; |
92 | 92 |
93 mlk_painter_set_color(0xffffffff); | 93 mlk_painter_set_color(0xffffffff); |
94 mlk_painter_clear(); | 94 mlk_painter_clear(); |
98 } | 98 } |
99 | 99 |
100 static void | 100 static void |
101 run(void) | 101 run(void) |
102 { | 102 { |
103 struct state state = { | 103 struct mlk_state state = { |
104 .handle = handle, | 104 .handle = handle, |
105 .update = update, | 105 .update = update, |
106 .draw = draw | 106 .draw = draw |
107 }; | 107 }; |
108 | 108 |