first attempt to create a UI for the atlas editor default tip

Fri, 22 May 2026 23:44:11 +0200

author
Mike Becker <universe@uap-core.de>
date
Fri, 22 May 2026 23:44:11 +0200
changeset 308
ef85db003415
parent 307
3bb4f69b94e0

first attempt to create a UI for the atlas editor

tools/atlas-editor.c file | annotate | diff | comparison | revisions
--- a/tools/atlas-editor.c	Thu May 21 12:34:40 2026 +0200
+++ b/tools/atlas-editor.c	Fri May 22 23:44:11 2026 +0200
@@ -27,8 +27,34 @@
 
 #include <ui/ui.h>
 
+static void draw_atlas(UiEvent* evt, UiGraphics* g, void* data) {
+    ui_graphics_color(g, 255, 128, 0);
+    ui_draw_rect(g, 0, 0, g->width, g->height, true);
+}
+
 static void application_startup([[maybe_unused]] UiEvent *event, [[maybe_unused]]  void *data) {
     UiObject *window = ui_window("Ascension - Texture Atlas Editor");
+
+    ui_grid(window, .columnspacing = 10, .margin = 10, .fill = true) {
+        ui_frame(window, .hexpand = true, .hfill = true, .vexpand = true, .vfill = true) {
+            ui_drawingarea(window, .draw = draw_atlas);
+        }
+        ui_vbox(window, .spacing = 5) {
+            ui_grid(window, .columnspacing = 10, .def_hexpand = true, .def_hfill = true) {
+                ui_button(window, .label = "Load Atlas");
+                ui_button(window, .label = "Save Atlas");
+            }
+            ui_button(window, .label = "Load Texture");
+            ui_separator(window);
+            ui_grid(window, .columnspacing = 10, .rowspacing = 2, .def_vfill = true) {
+                ui_label(window, .label = "Tile Width:");
+                ui_textfield(window, .width = 20);
+                ui_label(window, .label = "Tile Height:");
+                ui_textfield(window, .width = 20);
+            }
+        }
+    }
+
     ui_show(window);
 }
 

mercurial