From 25da8e01a0499c273357cb2feb2825b53e86795b Mon Sep 17 00:00:00 2001 From: aura Date: Wed, 25 Feb 2026 06:07:38 +0100 Subject: wip on toolview --- src/editor/gui.cpp | 60 +++++++++++++++++++++--------------------------------- 1 file changed, 23 insertions(+), 37 deletions(-) (limited to 'src/editor/gui.cpp') diff --git a/src/editor/gui.cpp b/src/editor/gui.cpp index 1060c00..39914c8 100644 --- a/src/editor/gui.cpp +++ b/src/editor/gui.cpp @@ -49,25 +49,6 @@ GUI_EDITORWINDOW* gui_editorwindow( I32 w, I32 h ) { return wnd; } -void editor_update_active_tool_label( GAME_EDITOR* e ) { - char lstr[256]; - switch( e->tool ) { - case EDITOR_TOOL_SELECT: - sprintf( lstr, "current tool: select" ); break; - case EDITOR_TOOL_WALL: - sprintf( lstr, "current tool: wall" ); break; - case EDITOR_TOOL_POLY: - sprintf( lstr, "current tool: polygon" ); break; - case EDITOR_TOOL_SPRITE: - sprintf( lstr, "current tool: sprite" ); break; - case EDITOR_TOOL_ENT: - sprintf( lstr, "current tool: entity" ); break; - default: - sprintf( lstr, "current tool: none" ); break; - } - - strcpy( e->gui.toollabel->name, lstr ); -} void editor_update_properties_column( GAME_EDITOR* e ) { GAME_EDITOR::EDITOR_GUI* egui = &e->gui; @@ -83,6 +64,28 @@ void editor_create_properties_column( GAME_EDITOR* e ) { gui_editor_propview_select( egui->props, e->map, EDITOR_SELECT_ORIGIN ); } +void editor_update_toolview( GAME_EDITOR* e ) { + GAME_EDITOR::EDITOR_GUI* egui = &e->gui; + gui_editor_toolview_update( egui->tool ); +} + +void settool( U8 t ) { editor->tool.type = t; } +void editor_create_toolview_column( GAME_EDITOR* e ) { + GAME_EDITOR::EDITOR_GUI* egui = &e->gui; + + I32 x = 320, y = 428, off = 23; + + gui_button( x, y, 45, 20, "none", pfn( void* ) { settool( EDITOR_TOOL_NONE ); } ); y += off; + gui_button( x, y, 45, 20, "select", pfn( void* ) { settool( EDITOR_TOOL_SELECT ); } ); y += off; + gui_button( x, y, 45, 20, "wall", pfn( void* ) { settool( EDITOR_TOOL_WALL ); } ); y += off; + gui_button( x, y, 45, 20, "poly", pfn( void* ) { settool( EDITOR_TOOL_POLY ); } ); y += off; + gui_button( x, y, 45, 20, "sprite", pfn( void* ) { settool( EDITOR_TOOL_SPRITE ); } ); y += off; + gui_button( x, y, 45, 20, "ent", pfn( void* ) { settool( EDITOR_TOOL_ENT ); } ); y += off; + + egui->tool = gui_editor_toolview( 370, 425, 300, 150 ); + gui_editor_toolview_update( egui->tool ); +} + void editor_create_game_view_column( GAME_EDITOR* e ) { GAME_EDITOR::EDITOR_GUI* egui = &e->gui; I32 x = 320, y = 10; @@ -104,23 +107,6 @@ void editor_create_game_view_column( GAME_EDITOR* e ) { egui->v3d->enabled = 1; } -void settool( U8 t ) { editor->tool = t; editor_update_active_tool_label( editor ); } -void editor_create_tools_row( GAME_EDITOR* e ) { - I32 x = 10, y = 520; - - e->gui.toollabel = gui_label( x, y, "current tool: none" ); - y += 16; - gui_button( x, y, 80, 20, "none", pfn( void* ) { settool( EDITOR_TOOL_NONE ); } ); x += 90; - gui_button( x, y, 80, 20, "select", pfn( void* ) { settool( EDITOR_TOOL_SELECT ); } ); x += 90; - gui_button( x, y, 80, 20, "wall", pfn( void* ) { settool( EDITOR_TOOL_WALL ); } ); x += 90; - - x = 10; y += 28; - gui_button( x, y, 80, 20, "polygon", pfn( void* ) { settool( EDITOR_TOOL_POLY ); } ); x += 90; - gui_button( x, y, 80, 20, "sprite", pfn( void* ) { settool( EDITOR_TOOL_SPRITE ); } ); x += 90; - gui_button( x, y, 80, 20, "entity", pfn( void* ) { settool( EDITOR_TOOL_ENT ); } ); x += 90; - editor_update_active_tool_label( e ); -} - void editor_create_map_view( GAME_EDITOR* e ) { if( !e->map ) { dlog( "editor_create_map_views() : no map loaded\n" ); @@ -139,8 +125,8 @@ void editor_create_map_view( GAME_EDITOR* e ) { gui_view( 1, 1, w->w - 2, w->h - 2 ); editor_create_properties_column( e ); + editor_create_toolview_column( e ); editor_create_game_view_column( e ); - editor_create_tools_row( e ); } void close_new_map_popup( void* ) { -- cgit v1.2.3