diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-12-02 14:20:48 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-12-02 14:29:13 +0100 |
commit | 14770f42df291753a240def91fb488a904a909c1 (patch) | |
tree | c1ef52c408cb365890da4aeb5536256040bb96fd /tests/main.c |
Initial commit, set up skeleton with list and button
Diffstat (limited to 'tests/main.c')
-rw-r--r-- | tests/main.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/main.c b/tests/main.c new file mode 100644 index 0000000..6a94414 --- /dev/null +++ b/tests/main.c @@ -0,0 +1,32 @@ +#include "../include/mgui/list.h" +#include "../include/mgui/button.h" +#include <mgl/mgl.h> +#include <mgl/window/window.h> +#include <mgl/window/event.h> + +int main() { + if(mgl_init() != 0) + return 1; + + mgl_window window; + if(mgl_window_create(&window, "mgl", &(mgl_window_create_params){ .size = {1280, 720} }) != 0) + return 1; + + mgui_list *list = mgui_list_create(MGUI_LIST_VERTICAL); + mgui_button *button = mgui_button_create(); + mgui_list_append(list, mgui_button_to_widget(button)); + + mgl_event event; + while(mgl_window_is_open(&window)) { + while(mgl_window_poll_event(&window, &event)) { + mgui_list_on_event(list, &window, &event); + } + + mgl_window_clear(&window, (mgl_color){0, 0, 0, 0}); + mgui_list_draw(list, &window); + mgl_window_display(&window); + } + + mgl_deinit(); + return 0; +} |