aboutsummaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorMarvin Borner2021-06-23 23:44:59 +0200
committerMarvin Borner2021-06-23 23:44:59 +0200
commit461e6fcb6a0abbf594ea08d6828b841ea6dc964e (patch)
tree25487387f068f80c100d1a2658864df422b6bee0 /apps
parentaf338d77ee7f6469530233a70ccb450171ec5c66 (diff)
Widget improvements
Diffstat (limited to 'apps')
-rw-r--r--apps/chess/main.c4
-rw-r--r--apps/paint/main.c15
-rw-r--r--apps/view/main.c6
3 files changed, 12 insertions, 13 deletions
diff --git a/apps/chess/main.c b/apps/chess/main.c
index fbb00e8..abfad59 100644
--- a/apps/chess/main.c
+++ b/apps/chess/main.c
@@ -214,8 +214,8 @@ static void draw_board(void)
{
for (u8 x = 0; x < 8; x++) {
for (u8 y = 0; y < 8; y++) {
- u32 widget = gui_widget(win, GUI_MAIN, vec2(TILE * x, TILE * y),
- vec2(TILE, TILE));
+ u32 widget = gui_widget(win, gui_main_widget(win), vec2(TILE * x, TILE * y),
+ vec2(TILE, TILE));
assert((signed)widget > 0);
u8 colored = (x + y + 1) % 2 == 0;
diff --git a/apps/paint/main.c b/apps/paint/main.c
index 0e90ee8..626d41d 100644
--- a/apps/paint/main.c
+++ b/apps/paint/main.c
@@ -37,24 +37,23 @@ int main(void)
u32 win = gui_window(APPNAME);
vec2 win_size = gui_window_size(win);
- u32 toolbar = gui_widget(win, GUI_MAIN, vec2(0, 0),
- vec2(win_size.x, COLOR_SIZE + 2 * TOOLBAR_MARGIN));
+ u32 toolbar = gui_widget(win, gui_main_widget(win), vec2(0, 0),
+ vec2(win_size.x, COLOR_SIZE + 2 * TOOLBAR_MARGIN));
gui_fill(win, toolbar, GUI_LAYER_BG, COLOR_WHITE);
u32 color_count = COUNT(colors);
for (u32 i = 0; i < color_count; i++) {
u32 color = gui_widget(win, toolbar,
- vec2(TOOLBAR_MARGIN + i * (COLOR_SIZE + TOOLBAR_MARGIN),
- TOOLBAR_MARGIN),
- vec2(COLOR_SIZE, COLOR_SIZE));
+ vec2(TOOLBAR_MARGIN + i * (COLOR_SIZE + TOOLBAR_MARGIN),
+ TOOLBAR_MARGIN),
+ vec2(COLOR_SIZE, COLOR_SIZE));
gui_fill(win, color, GUI_LAYER_FG, colors[i]);
gui_draw_border(win, color, GUI_LAYER_FG, 2, COLOR_BLACK);
gui_widget_listen(win, color, GUI_LISTEN_MOUSECLICK, (u32)color_click);
}
- u32 canvas =
- gui_widget(win, GUI_MAIN, vec2(0, COLOR_SIZE + 2 * TOOLBAR_MARGIN),
- vec2(win_size.x, win_size.y - (COLOR_SIZE + 2 * TOOLBAR_MARGIN)));
+ u32 canvas = gui_widget(win, gui_main_widget(win), vec2(0, COLOR_SIZE + 2 * TOOLBAR_MARGIN),
+ vec2(win_size.x, win_size.y - (COLOR_SIZE + 2 * TOOLBAR_MARGIN)));
gui_fill(win, canvas, GUI_LAYER_BG, COLOR_WHITE);
gui_widget_listen(win, canvas, GUI_LISTEN_MOUSEMOVE, (u32)mousemove);
diff --git a/apps/view/main.c b/apps/view/main.c
index 20661a7..fc7e3bc 100644
--- a/apps/view/main.c
+++ b/apps/view/main.c
@@ -25,10 +25,10 @@ int main(int argc, char *argv[])
path = "/res/test.png";
- u32 win = gui_new_custom_window(APPNAME, vec2(0, 0), size);
- u32 canvas = gui_new_widget(win, GUI_MAIN, vec2(0, 0), size);
+ u32 win = gui_custom_window(APPNAME, vec2(0, 0), size);
+ u32 canvas = gui_widget(win, gui_main_widget(win), vec2(0, 0), size);
gui_fill(win, canvas, GUI_LAYER_BG, COLOR_WHITE);
- gui_listen_widget(win, canvas, GUI_LISTEN_MOUSEMOVE, (u32)mousemove);
+ gui_widget_listen(win, canvas, GUI_LISTEN_MOUSEMOVE, (u32)mousemove);
gui_redraw_window(win);
gui_loop();