aboutsummaryrefslogtreecommitdiff
path: root/apps/window.c
diff options
context:
space:
mode:
authorMarvin Borner2021-02-22 23:23:08 +0100
committerMarvin Borner2021-02-22 23:23:08 +0100
commit53679300c7a20dc21f96b1e502585204b36eda35 (patch)
treefb50e5f881f90fd8915baf2af4a1e4ce679c126f /apps/window.c
parent4c527e07fff9ed0a1eb0f34f1abd943706a0dba1 (diff)
Started new frontend lib
Diffstat (limited to 'apps/window.c')
-rw-r--r--apps/window.c42
1 files changed, 6 insertions, 36 deletions
diff --git a/apps/window.c b/apps/window.c
index 6d738dc..5608ae3 100644
--- a/apps/window.c
+++ b/apps/window.c
@@ -1,44 +1,14 @@
-// MIT License, Copyright (c) 2020 Marvin Borner
+// MIT License, Copyright (c) 2021 Marvin Borner
-#include <conv.h>
-#include <def.h>
-#include <gfx.h>
+#include <assert.h>
#include <gui.h>
-#include <input.h>
#include <print.h>
-#include <str.h>
-
-void on_click(void *e, struct element *elem)
-{
- (void)e;
-
- struct element_button *b = elem->data;
- b->color_bg = COLOR_MAGENTA;
- b->color_fg = COLOR_WHITE;
- gui_sync(elem);
-
- u32 time = time();
- while (time + 200 > time())
- yield();
-
- b->color_bg = COLOR_WHITE;
- b->color_fg = COLOR_BLACK;
- gui_sync(elem);
-}
int main()
{
- struct element *root = gui_init("test", 600, 400, COLOR_BG);
- struct element *container = gui_add_container(root, 0, 0, 50, 100, COLOR_RED);
- struct element *button =
- gui_add_button(container, 10, 10, FONT_24, "Button", COLOR_WHITE, COLOR_BLACK);
- struct element *text_input =
- gui_add_text_input(container, 10, 50, 70, FONT_24, COLOR_WHITE, COLOR_BLACK);
- (void)text_input;
-
- button->event.on_click = on_click;
-
- gui_event_loop(root);
-
+ struct gui_window win = { 0 };
+ assert(gui_new_window(&win) > 0);
+ /* assert(gui_redraw_window(win.id) > 0); */
+ log("%d\n", win.ctx->size.x);
return 0;
}