Mercurial > molko
comparison examples/example-label/main.c @ 261:bfde372bf152
core: prefix utilities with util_
author | David Demelier <markand@malikania.fr> |
---|---|
date | Sun, 06 Dec 2020 23:06:34 +0100 |
parents | 76afe639fd72 |
children | 196264679079 |
comparison
equal
deleted
inserted
replaced
260:60a214ec1ab4 | 261:bfde372bf152 |
---|---|
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
17 */ | 17 */ |
18 | |
19 #include <stddef.h> | |
18 | 20 |
19 #include <core/core.h> | 21 #include <core/core.h> |
20 #include <core/event.h> | 22 #include <core/event.h> |
21 #include <core/game.h> | 23 #include <core/game.h> |
22 #include <core/painter.h> | 24 #include <core/painter.h> |
105 if (!core_init("fr.malikania", "label") || !ui_init()) | 107 if (!core_init("fr.malikania", "label") || !ui_init()) |
106 panic(); | 108 panic(); |
107 if (!window_open("Example - Label", W, H)) | 109 if (!window_open("Example - Label", W, H)) |
108 panic(); | 110 panic(); |
109 | 111 |
110 for (size_t i = 0; i < NELEM(table); ++i) { | 112 for (size_t i = 0; i < UTIL_SIZE(table); ++i) { |
111 struct label *l = &table[i].label; | 113 struct label *l = &table[i].label; |
112 unsigned int w, h; | 114 unsigned int w, h; |
113 | 115 |
114 label_query(l, &w, &h); | 116 label_query(l, &w, &h); |
115 align(table[i].align, &l->x, &l->y, w, h, 0, 0, W, H); | 117 align(table[i].align, &l->x, &l->y, w, h, 0, 0, W, H); |
148 (void)st; | 150 (void)st; |
149 | 151 |
150 painter_set_color(0x4f8fbaff); | 152 painter_set_color(0x4f8fbaff); |
151 painter_clear(); | 153 painter_clear(); |
152 | 154 |
153 for (size_t i = 0; i < NELEM(table); ++i) | 155 for (size_t i = 0; i < UTIL_SIZE(table); ++i) |
154 label_draw(&table[i].label); | 156 label_draw(&table[i].label); |
155 | 157 |
156 label_draw(&mlabel); | 158 label_draw(&mlabel); |
157 painter_present(); | 159 painter_present(); |
158 } | 160 } |