tools/atlas-editor.c

changeset 309
8124d12deb04
parent 308
ef85db003415
equal deleted inserted replaced
308:ef85db003415 309:8124d12deb04
30 static void draw_atlas(UiEvent* evt, UiGraphics* g, void* data) { 30 static void draw_atlas(UiEvent* evt, UiGraphics* g, void* data) {
31 ui_graphics_color(g, 255, 128, 0); 31 ui_graphics_color(g, 255, 128, 0);
32 ui_draw_rect(g, 0, 0, g->width, g->height, true); 32 ui_draw_rect(g, 0, 0, g->width, g->height, true);
33 } 33 }
34 34
35 static void application_startup([[maybe_unused]] UiEvent *event, [[maybe_unused]] void *data) { 35 static void application_startup([[maybe_unused]] UiEvent *event, [[maybe_unused]] void *data) {
36 UiObject *window = ui_window("Ascension - Texture Atlas Editor"); 36 UiObject *window = ui_window("Ascension - Texture Atlas Editor");
37 37
38 ui_grid(window, .columnspacing = 10, .margin = 10, .fill = true) { 38 ui_grid(window, .columnspacing = 10, .margin = 10, .fill = true) {
39 ui_frame(window, .hexpand = true, .hfill = true, .vexpand = true, .vfill = true) { 39 ui_frame(window, .hexpand = true, .hfill = true, .vexpand = true, .vfill = true,
40 .subcontainer = UI_CONTAINER_NO_SUB) {
40 ui_drawingarea(window, .draw = draw_atlas); 41 ui_drawingarea(window, .draw = draw_atlas);
41 } 42 }
42 ui_vbox(window, .spacing = 5) { 43 ui_vbox(window, .spacing = 5) {
43 ui_grid(window, .columnspacing = 10, .def_hexpand = true, .def_hfill = true) { 44 ui_grid(window, .columnspacing = 10, .def_hexpand = true, .def_hfill = true) {
44 ui_button(window, .label = "Load Atlas"); 45 ui_button(window, .label = "Load Atlas");
46 } 47 }
47 ui_button(window, .label = "Load Texture"); 48 ui_button(window, .label = "Load Texture");
48 ui_separator(window); 49 ui_separator(window);
49 ui_grid(window, .columnspacing = 10, .rowspacing = 2, .def_vfill = true) { 50 ui_grid(window, .columnspacing = 10, .rowspacing = 2, .def_vfill = true) {
50 ui_label(window, .label = "Tile Width:"); 51 ui_label(window, .label = "Tile Width:");
51 ui_textfield(window, .width = 20); 52 ui_textfield(window, .width = 20); // TODO: in current toolkit version, width is not accepted
52 ui_label(window, .label = "Tile Height:"); 53 ui_label(window, .label = "Tile Height:");
53 ui_textfield(window, .width = 20); 54 ui_textfield(window, .width = 20);
54 } 55 }
55 } 56 }
56 } 57 }

mercurial