From af338d77ee7f6469530233a70ccb450171ec5c66 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Wed, 23 Jun 2021 22:05:11 +0200 Subject: Started widgets and layout stuff --- apps/chess/main.c | 6 +++--- apps/paint/main.c | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'apps') diff --git a/apps/chess/main.c b/apps/chess/main.c index 64911dc..fbb00e8 100644 --- a/apps/chess/main.c +++ b/apps/chess/main.c @@ -214,7 +214,7 @@ static void draw_board(void) { for (u8 x = 0; x < 8; x++) { for (u8 y = 0; y < 8; y++) { - u32 widget = gui_new_widget(win, GUI_MAIN, vec2(TILE * x, TILE * y), + u32 widget = gui_widget(win, GUI_MAIN, vec2(TILE * x, TILE * y), vec2(TILE, TILE)); assert((signed)widget > 0); @@ -225,7 +225,7 @@ static void draw_board(void) gui_fill(win, widget, GUI_LAYER_BG, colored ? DARK_COLOR : LIGHT_COLOR); struct piece *tile = &tiles[x][y]; - gui_listen_widget(win, widget, GUI_LISTEN_MOUSECLICK, (u32)mouseclick); + gui_widget_listen(win, widget, GUI_LISTEN_MOUSECLICK, (u32)mouseclick); tile->widget = widget; @@ -239,7 +239,7 @@ static void draw_board(void) int main(void) { - win = gui_new_custom_window(APPNAME, vec2(0, 0), vec2(TILE * 8, TILE * 8)); + win = gui_custom_window(APPNAME, vec2(0, 0), vec2(TILE * 8, TILE * 8)); fen_parse(START_FEN); draw_board(); diff --git a/apps/paint/main.c b/apps/paint/main.c index aed784c..0e90ee8 100644 --- a/apps/paint/main.c +++ b/apps/paint/main.c @@ -34,29 +34,29 @@ static void color_click(struct gui_event_mouse *event) // TODO: Fix and improve paint without KVM int main(void) { - u32 win = gui_new_window(APPNAME); + u32 win = gui_window(APPNAME); vec2 win_size = gui_window_size(win); - u32 toolbar = gui_new_widget(win, GUI_MAIN, vec2(0, 0), + u32 toolbar = gui_widget(win, GUI_MAIN, 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_new_widget(win, toolbar, + u32 color = gui_widget(win, toolbar, 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_listen_widget(win, color, GUI_LISTEN_MOUSECLICK, (u32)color_click); + gui_widget_listen(win, color, GUI_LISTEN_MOUSECLICK, (u32)color_click); } u32 canvas = - gui_new_widget(win, GUI_MAIN, vec2(0, COLOR_SIZE + 2 * TOOLBAR_MARGIN), + gui_widget(win, GUI_MAIN, 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_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(); -- cgit v1.2.3