From 205f7d49530e6c32ec0a09045d9cb45dcf9b1752 Mon Sep 17 00:00:00 2001 From: quou Date: Wed, 31 Jul 2024 22:12:48 +1000 Subject: GUI + map editor beginnings --- editor.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 editor.c (limited to 'editor.c') diff --git a/editor.c b/editor.c new file mode 100644 index 0000000..0aae694 --- /dev/null +++ b/editor.c @@ -0,0 +1,29 @@ +#include "editor.h" +#include "asset.h" +#include "gui.h" +#include "map.h" +#include "render.h" + +static GUI_Scroll_State map_ss = { 0 }; + +void draw_map_scrollable( + GUI* g, + Renderer* r, + const Rect* rect, + const GUI_Scroll_State* ss +) { + (void)g; + (void)ss; + ren_texture(r, rect, get_texture(asset_id_floorboards_texture)); +} + +void edit_map(Editor* e, GUI* g, Map* m) { + Rect b = gui_viewport(g); + Rect t = gui_cut_up(&b, gui_text_height() + 4); + (void)e; + (void)m; + gui_btn(g, gui_cut_left(&t, gui_text_width("Load", 4) + 4), "Save"); + gui_btn(g, gui_cut_left(&t, gui_text_width("Save", 4) + 4), "Load"); + gui_scrollable(g, b, &map_ss, draw_map_scrollable); +} + -- cgit v1.2.3-54-g00ecf