diff options
| author | kasull <qsullian@gmail.com> | 2026-03-03 12:22:40 -0500 |
|---|---|---|
| committer | kasull <qsullian@gmail.com> | 2026-03-03 12:22:40 -0500 |
| commit | 5c4e9c8b140b14ba9671b8efcc47d71c6c4f2217 (patch) | |
| tree | c011086a55a9fff0130a71a66f1c06029410b135 /src/editor/gui.cpp | |
| parent | 413ef78504278d37080b9b59a652e4bbd5e2a0fc (diff) | |
ui header/menu and add undo/redo for creation actions
full-width toolbar/menubar layer
move save into file menu and add edit menu actions for undo/redo
menubar dropdown interaction modal
update header/view-type labels and menu layout behavior
creation-history tracking for walls and polygons
undo (ctrl+z) and redo (ctrl+r) in 2d editor
improve list/button visual states
Diffstat (limited to 'src/editor/gui.cpp')
| -rw-r--r-- | src/editor/gui.cpp | 352 |
1 files changed, 334 insertions, 18 deletions
diff --git a/src/editor/gui.cpp b/src/editor/gui.cpp index 92f3f7c..04e69f1 100644 --- a/src/editor/gui.cpp +++ b/src/editor/gui.cpp @@ -6,8 +6,10 @@ const I32 EDITOR_LAYOUT_MARGIN = 10; const I32 EDITOR_LAYOUT_TITLE_OFFSET = 15; -const I32 EDITOR_LAYOUT_NAV_Y = 10; -const I32 EDITOR_LAYOUT_CONTENT_Y = 38; +const I32 EDITOR_LAYOUT_MENU_Y = 1; +const I32 EDITOR_LAYOUT_MENU_H = 22; +const I32 EDITOR_LAYOUT_NAV_Y = EDITOR_LAYOUT_MENU_Y + EDITOR_LAYOUT_MENU_H + 4; +const I32 EDITOR_LAYOUT_CONTENT_Y = EDITOR_LAYOUT_NAV_Y + 28; const I32 EDITOR_LAYOUT_COLUMN_GAP = 10; const I32 EDITOR_LAYOUT_VIEW_TOOL_GAP = 17; const I32 EDITOR_LAYOUT_TOOL_BTN_TOP_GAP = 3; @@ -40,6 +42,13 @@ struct GUI_EDITOR_VIEWTYPE_SEGMENT : GUI_BASE { I32 held_seg{-1}; }; +struct GUI_EDITOR_TOOLBAR : GUI_BASE { + U8 held{}; + I32 held_item{-1}; + U8 file_open{}; + U8 edit_open{}; +}; + enum EditorViewMode_t { EDITOR_VIEWMODE_2D = 0, EDITOR_VIEWMODE_3D = 1, @@ -53,6 +62,27 @@ enum Editor2DViewType_t { }; static void editor_layout_map_view( GAME_EDITOR* e ); +static U8 editor_menu_hover_mask_active = 0; +static I32 editor_menu_hover_real_x = 0; +static I32 editor_menu_hover_real_y = 0; + +enum EditorToolbarHit_t { + EDITOR_TOOLBAR_HIT_NONE = -1, + EDITOR_TOOLBAR_HIT_FILE = 0, + EDITOR_TOOLBAR_HIT_EDIT = 1, + EDITOR_TOOLBAR_HIT_VIEW = 2, + EDITOR_TOOLBAR_HIT_TOOLS = 3, + EDITOR_TOOLBAR_HIT_SAVE = 4, + EDITOR_TOOLBAR_HIT_UNDO = 5, + EDITOR_TOOLBAR_HIT_REDO = 6 +}; + +static void editor_toolbar_set_open( GUI_EDITOR_TOOLBAR* bar, U8 file_open, U8 edit_open ); + +static void editor_toolbar_close_menu() { + GUI_EDITOR_TOOLBAR* bar = (GUI_EDITOR_TOOLBAR*)editor->gui.header_toolbar; + editor_toolbar_set_open( bar, 0, 0 ); +} static void editor_apply_view_mode( GAME_EDITOR* e ) { if( !e || !e->gui.v2d || !e->gui.v3d ) @@ -70,14 +100,12 @@ static void editor_apply_view_mode( GAME_EDITOR* e ) { } static void editor_header_back_cb( void* ) { + editor_toolbar_close_menu(); editor_close( editor ); } -static void editor_header_save_cb( void* ) { - editor_save_map( editor ); -} - static void editor_set_view_mode( I32 mode ) { + editor_toolbar_close_menu(); editor->gui.view_mode = mode; editor_apply_view_mode( editor ); editor_layout_map_view( editor ); @@ -138,7 +166,7 @@ static void gui_editor_viewtype_segment_draw_fn( void* ptr ) { editor_header_viewtype_segment_widths( inner_w, &w0, &w1, &w2 ); I32 segx[3] = { inner_x, inner_x + w0, inner_x + w0 + w1 }; I32 segw[3] = { w0, w1, w2 }; - const char* txts[3] = { "top down", "side", "front" }; + const char* txts[3] = { "x/y", "x/z", "y/z" }; for( I32 i = 0; i < 3; ++i ) { U8 selected = i == active_seg; @@ -213,6 +241,250 @@ static GUI_EDITOR_VIEWTYPE_SEGMENT* gui_editor_viewtype_segment( I32 x, I32 y, I return seg; } +const I32 EDITOR_TOOLBAR_DROPDOWN_W = 74; + +static U8 editor_toolbar_pt_in_rect( I32 mx, I32 my, I32 x, I32 y, I32 w, I32 h ) { + return mx >= x && mx < x + w && my >= y && my < y + h; +} + +static void editor_toolbar_set_open( GUI_EDITOR_TOOLBAR* bar, U8 file_open, U8 edit_open ) { + if( !bar ) + return; + + bar->file_open = file_open; + bar->edit_open = edit_open; +} + +static void editor_toolbar_item_rect( GUI_EDITOR_TOOLBAR* bar, I32 idx, I32* rx, I32* ry, I32* rw, I32* rh ) { + static const I32 widths[4] = { 44, 44, 44, 52 }; + I32 x = gui_relx( bar ); + I32 y = gui_rely( bar ); + I32 cx = x + 8; + for( I32 i = 0; i < idx; ++i ) + cx += widths[i] + 4; + + *rx = cx; + *ry = y + 2; + *rw = widths[idx]; + *rh = max( 1, bar->h - 4 ); +} + +static void editor_toolbar_dropdown_row_rect( GUI_EDITOR_TOOLBAR* bar, I32 anchor_idx, I32 row, I32* rx, I32* ry, I32* rw, I32* rh ) { + I32 x = 0, y = 0, w = 0, h = 0; + editor_toolbar_item_rect( bar, anchor_idx, &x, &y, &w, &h ); + *rx = x; + *rh = max( 18, h ); + *ry = gui_rely( bar ) + bar->h + row * *rh; + *rw = EDITOR_TOOLBAR_DROPDOWN_W; +} + +static I32 editor_toolbar_hit_test( GUI_EDITOR_TOOLBAR* bar, I32 mx, I32 my ) { + for( I32 i = 0; i < 4; ++i ) { + I32 x = 0, y = 0, w = 0, h = 0; + editor_toolbar_item_rect( bar, i, &x, &y, &w, &h ); + if( editor_toolbar_pt_in_rect( mx, my, x, y, w, h ) ) + return i; + } + + if( bar->file_open ) { + I32 x = 0, y = 0, w = 0, h = 0; + editor_toolbar_dropdown_row_rect( bar, EDITOR_TOOLBAR_HIT_FILE, 0, &x, &y, &w, &h ); + if( editor_toolbar_pt_in_rect( mx, my, x, y, w, h ) ) + return EDITOR_TOOLBAR_HIT_SAVE; + } + + if( bar->edit_open ) { + for( I32 i = 0; i < 2; ++i ) { + I32 x = 0, y = 0, w = 0, h = 0; + editor_toolbar_dropdown_row_rect( bar, EDITOR_TOOLBAR_HIT_EDIT, i, &x, &y, &w, &h ); + if( editor_toolbar_pt_in_rect( mx, my, x, y, w, h ) ) + return i == 0 ? EDITOR_TOOLBAR_HIT_UNDO : EDITOR_TOOLBAR_HIT_REDO; + } + } + + return EDITOR_TOOLBAR_HIT_NONE; +} + +static void gui_editor_toolbar_draw_fn( void* ptr ) { + GUI_EDITOR_TOOLBAR* bar = (GUI_EDITOR_TOOLBAR*)ptr; + I32 x = gui_relx( bar ); + I32 y = gui_rely( bar ); + I32 mx, my; + if( editor_menu_hover_mask_active ) { + mx = editor_menu_hover_real_x; + my = editor_menu_hover_real_y; + } else { + gui_cursor_pos( &mx, &my ); + } + U8 m1 = gui_mbutton_down( GUI_MBTNLEFT ); + I32 hover = editor_toolbar_hit_test( bar, mx, my ); + CLR hover_fill = CLR::blend( ui_clr.border, ui_clr.bg, 0.70f ); + CLR active_fill = CLR::blend( ui_clr.bg_sec, ui_clr.border, 0.22f ); + + CLR border = gui_is_fg_window( bar ) ? ui_clr.border : ui_clr.border_inactive; + gui_draw_frect( x, y, bar->w, bar->h, ui_clr.bg_sec ); + + static const char* labels[4] = { "file", "edit", "view", "tools" }; + for( I32 i = 0; i < 4; ++i ) { + I32 rx = 0, ry = 0, rw = 0, rh = 0; + editor_toolbar_item_rect( bar, i, &rx, &ry, &rw, &rh ); + U8 is_hover = hover == i; + U8 is_active = bar->held && bar->held_item == i && m1; + U8 is_open = ( bar->file_open && i == EDITOR_TOOLBAR_HIT_FILE ) + || ( bar->edit_open && i == EDITOR_TOOLBAR_HIT_EDIT ); + + CLR fill = ui_clr.bg_sec; + if( is_open ) + fill = hover_fill; + else if( is_active ) + fill = active_fill; + else if( is_hover ) + fill = hover_fill; + + if( is_open || is_active || is_hover ) + gui_draw_frect( rx, ry, rw, rh, fill ); + gui_draw_str( rx + 6, y + bar->h / 2 - 8, ALIGN_L, FNT_JPN12, ui_clr.txt, labels[i] ); + } + + if( bar->file_open ) { + I32 rx = 0, ry = 0, rw = 0, rh = 0; + editor_toolbar_dropdown_row_rect( bar, EDITOR_TOOLBAR_HIT_FILE, 0, &rx, &ry, &rw, &rh ); + U8 is_hover = hover == EDITOR_TOOLBAR_HIT_SAVE; + U8 is_active = bar->held && bar->held_item == EDITOR_TOOLBAR_HIT_SAVE && m1; + + gui_draw_frect( rx, ry, rw, rh, border ); + CLR fill = ui_clr.bg_sec; + if( is_active ) + fill = active_fill; + else if( is_hover ) + fill = hover_fill; + + gui_draw_frect( rx + 1, ry + 1, max( 1, rw - 2 ), max( 1, rh - 2 ), fill ); + gui_draw_str( rx + 8, ry + rh / 2 - 8, ALIGN_L, FNT_JPN12, ui_clr.txt, "save" ); + } + + if( bar->edit_open ) { + const U8 enabled[2] = { editor->undo_actions.size > 0, editor->redo_actions.size > 0 }; + const char* labels[2] = { "undo", "redo" }; + const I32 hit_id[2] = { EDITOR_TOOLBAR_HIT_UNDO, EDITOR_TOOLBAR_HIT_REDO }; + + I32 panel_x = 0, panel_y = 0, panel_w = 0, panel_h = 0; + editor_toolbar_dropdown_row_rect( bar, EDITOR_TOOLBAR_HIT_EDIT, 0, &panel_x, &panel_y, &panel_w, &panel_h ); + I32 row_h = panel_h; + gui_draw_frect( panel_x, panel_y, panel_w, row_h * 2, border ); + gui_draw_frect( panel_x + 1, panel_y + 1, max( 1, panel_w - 2 ), max( 1, row_h * 2 - 2 ), ui_clr.bg_sec ); + + for( I32 i = 0; i < 2; ++i ) { + I32 rx = 0, ry = 0, rw = 0, rh = 0; + editor_toolbar_dropdown_row_rect( bar, EDITOR_TOOLBAR_HIT_EDIT, i, &rx, &ry, &rw, &rh ); + U8 is_hover = hover == hit_id[i]; + U8 is_active = bar->held && bar->held_item == hit_id[i] && m1; + + CLR fill = ui_clr.bg_sec; + if( enabled[i] && is_active ) + fill = active_fill; + else if( is_hover ) + fill = hover_fill; + gui_draw_frect( rx + 1, ry + 1, max( 1, rw - 2 ), max( 1, rh - 2 ), fill ); + + CLR txt_clr = enabled[i] ? ui_clr.txt : ui_clr.txt_inactive; + gui_draw_str( rx + 8, ry + rh / 2 - 8, ALIGN_L, FNT_JPN12, txt_clr, labels[i] ); + } + } +} + +static void gui_editor_toolbar_input_fn( void* ptr ) { + GUI_EDITOR_TOOLBAR* bar = (GUI_EDITOR_TOOLBAR*)ptr; + I32 mx, my; + gui_cursor_pos( &mx, &my ); + U8 m1 = gui_mbutton_down( GUI_MBTNLEFT ); + I32 hit = editor_toolbar_hit_test( bar, mx, my ); + + if( m1 ) { + if( !bar->held ) { + bar->held = 1; + bar->held_item = hit; + if( hit == EDITOR_TOOLBAR_HIT_NONE && ( bar->file_open || bar->edit_open ) ) + editor_toolbar_set_open( bar, 0, 0 ); + } + return; + } + + if( bar->held && bar->held_item == hit ) { + switch( hit ) { + case EDITOR_TOOLBAR_HIT_FILE: + editor_toolbar_set_open( bar, !bar->file_open, 0 ); + break; + case EDITOR_TOOLBAR_HIT_EDIT: + editor_toolbar_set_open( bar, 0, !bar->edit_open ); + break; + case EDITOR_TOOLBAR_HIT_SAVE: + editor_toolbar_set_open( bar, 0, 0 ); + editor_save_map( editor ); + break; + case EDITOR_TOOLBAR_HIT_UNDO: + editor_toolbar_set_open( bar, 0, 0 ); + editor_undo( editor ); + break; + case EDITOR_TOOLBAR_HIT_REDO: + editor_toolbar_set_open( bar, 0, 0 ); + editor_redo( editor ); + break; + case EDITOR_TOOLBAR_HIT_VIEW: + case EDITOR_TOOLBAR_HIT_TOOLS: + editor_toolbar_set_open( bar, 0, 0 ); + break; + default: + break; + } + } + + bar->held = 0; + bar->held_item = EDITOR_TOOLBAR_HIT_NONE; +} + +static GUI_EDITOR_TOOLBAR* gui_editor_toolbar( I32 x, I32 y, I32 w, I32 h, const char* name ) { + if( !gui_check_target() ) + return 0; + + GUI_EDITOR_TOOLBAR* bar = new GUI_EDITOR_TOOLBAR; + bar->x = x; + bar->y = y; + bar->w = w; + bar->h = h; + bar->xbound = w; + bar->ybound = h + 52; + bar->draw_fn = gui_editor_toolbar_draw_fn; + bar->input_fn = gui_editor_toolbar_input_fn; + bar->held = 0; + bar->held_item = EDITOR_TOOLBAR_HIT_NONE; + bar->file_open = 0; + bar->edit_open = 0; + strcpy( bar->name, name ); + + GUI_VIEW* parent = gui_get_view(); + bar->parent = parent; + parent->children.push( bar ); + return bar; +} + +static void editor_raise_header_toolbar( GAME_EDITOR* e ) { + if( !e || !e->gui.header_toolbar ) + return; + + GUI_BASE* bar = e->gui.header_toolbar; + GUI_BASE* parent = bar->parent; + if( !parent ) + return; + + I32 idx = parent->children.idx_of( bar ); + if( idx == -1 || idx == (I32)parent->children.size - 1 ) + return; + + parent->children.erase( idx ); + parent->children.push( bar ); +} + struct EDITOR_LAYOUT { I32 left_x; I32 left_w; @@ -260,8 +532,9 @@ static void editor_set_bounds( GUI_BASE* node, I32 x, I32 y, I32 w, I32 h ) { static void editor_create_header_controls( GAME_EDITOR* e ) { GAME_EDITOR::EDITOR_GUI* egui = &e->gui; + egui->header_toolbar = gui_editor_toolbar( 1, EDITOR_LAYOUT_MENU_Y, e->wnd->w - 3, EDITOR_LAYOUT_MENU_H, "editor toolbar" ); + egui->header_back = gui_button( 10, EDITOR_LAYOUT_NAV_Y, 92, 20, "[ back ]", editor_header_back_cb ); - egui->header_save = gui_button( 110, EDITOR_LAYOUT_NAV_Y, 92, 20, "[ save ]", editor_header_save_cb ); egui->header_viewtype_label = gui_label( 250, EDITOR_LAYOUT_NAV_Y + 4, "view type:" ); egui->header_viewtype = gui_editor_viewtype_segment( 320, EDITOR_LAYOUT_NAV_Y, 186, 20, "viewtype segment" ); @@ -333,7 +606,7 @@ const I32 EDITOR_ASSETS_ROW_H = 28; const I32 EDITOR_ASSETS_THUMB = 20; const I32 EDITOR_ASSETS_INNER_PAD_X = 8; const I32 EDITOR_ASSETS_INNER_PAD_Y = 6; -const I32 EDITOR_ASSETS_SCROLLBAR_W = 8; +const I32 EDITOR_ASSETS_SCROLLBAR_W = 7; const I32 EDITOR_ASSETS_SCROLLBAR_GAP = 4; const I32 EDITOR_ASSETS_SCROLL_STEP = 20; @@ -368,7 +641,7 @@ static EDITOR_ASSETS_LAYOUT editor_assets_layout( GUI_EDITOR_INFOBOX* box, I32 p if( l.show_scroll ) l.row_w -= EDITOR_ASSETS_SCROLLBAR_W + EDITOR_ASSETS_SCROLLBAR_GAP; l.row_w = max( 1, l.row_w ); - l.track_x = l.inner_x + l.inner_w - EDITOR_ASSETS_SCROLLBAR_W; + l.track_x = l.inner_x + l.inner_w - EDITOR_ASSETS_SCROLLBAR_W - 1 - ( EDITOR_ASSETS_SCROLLBAR_GAP / 2 ); l.track_y = l.inner_y; l.track_h = l.list_h - 2; return l; @@ -407,11 +680,9 @@ static void gui_editor_infobox_draw_assets( GUI_EDITOR_INFOBOX* box, I32 panel_x CLR rowbg = idx % 2 ? ui_clr.bg : ui_clr.bg_alt; if( selected ) - rowbg = CLR::blend( (CLR){ 0.f, 1.f, 0.f, 1.f }, ui_clr.bg, 0.85f ); + rowbg = CLR::blend( ui_clr.border, ui_clr.bg, 0.70f ); gui_draw_frect( l.row_x, row_y, l.row_w, EDITOR_ASSETS_ROW_H - 2, rowbg ); - if( selected ) - gui_draw_rect( l.row_x, row_y, l.row_w, EDITOR_ASSETS_ROW_H - 2, (CLR){ 0.f, 1.f, 0.f, 1.f } ); I32 tx = l.row_x + 3; I32 ty = row_y + 3; @@ -426,7 +697,7 @@ static void gui_editor_infobox_draw_assets( GUI_EDITOR_INFOBOX* box, I32 panel_x } I32 text_x = tx + EDITOR_ASSETS_THUMB + 8; - CLR txt = selected ? (CLR){ 0.8f, 1.f, 0.8f, 1.f } : ui_clr.txt; + CLR txt = ui_clr.txt; if( map_entry ) { gui_draw_str( text_x, row_y + 7, ALIGN_L, FNT_JPN12, txt, "[map] -> %s", map->name ); } else if( p->tex ) { @@ -445,7 +716,7 @@ static void gui_editor_infobox_draw_assets( GUI_EDITOR_INFOBOX* box, I32 panel_x thumb_h = min( thumb_h, l.track_h ); I32 travel = max( 1, l.track_h - thumb_h ); I32 thumb_y = l.track_y + ( travel * editor->gui.assets_scroll ) / max( 1, l.max_scroll ); - gui_draw_frect( l.track_x + 1, thumb_y + 1, EDITOR_ASSETS_SCROLLBAR_W - 2, max( 1, thumb_h - 2 ), ui_clr.txt ); + gui_draw_frect( l.track_x, thumb_y + 1, EDITOR_ASSETS_SCROLLBAR_W, max( 1, thumb_h - 1 ), ui_clr.txt ); } } @@ -683,16 +954,18 @@ static void editor_layout_map_view( GAME_EDITOR* e ) { return; EDITOR_LAYOUT l = editor_calc_layout( e ); + editor_raise_header_toolbar( e ); GAME_EDITOR::EDITOR_GUI* egui = &e->gui; + GUI_BASE* toolbar = egui->header_toolbar; GUI_BUTTON* back = egui->header_back; - GUI_BUTTON* save = egui->header_save; GUI_BUTTON* v2btn = egui->header_mode_2d; GUI_BUTTON* v3btn = egui->header_mode_3d; GUI_BUTTON* simbtn = egui->header_mode_sim; GUI_LABEL* view_type_lbl = egui->header_viewtype_label; GUI_BASE* view_type_seg = egui->header_viewtype; + const I32 menu_btn_y = EDITOR_LAYOUT_MENU_Y; const I32 top_btn_y = l.top_y; const I32 top_btn_h = 20; const I32 nav_left_x = 10; @@ -707,8 +980,9 @@ static void editor_layout_map_view( GAME_EDITOR* e ) { I32 max_type_w = mode_x - type_seg_x - 8; I32 type_seg_w = min( 174, max( 120, max_type_w ) ); + editor_set_bounds( toolbar, 1, menu_btn_y, e->wnd->w - 3, EDITOR_LAYOUT_MENU_H ); + editor_set_bounds( back, nav_left_x, top_btn_y, nav_btn_w, top_btn_h ); - editor_set_bounds( save, nav_left_x + nav_btn_w + nav_gap, top_btn_y, nav_btn_w, top_btn_h ); GUI_BUTTON* mode_btns[] = { v2btn, v3btn, simbtn }; const char* mode_names[] = { "[ 2d view ]", "[ 3d view ]", "[ simulation ]" }; @@ -796,6 +1070,21 @@ static void editor_layout_map_view( GAME_EDITOR* e ) { void gui_editorwindow_draw_fn( void* ptr ) { GUI_EDITORWINDOW* wnd = (GUI_EDITORWINDOW*)ptr; + editor_raise_header_toolbar( editor ); + GUI_BASE* toolbar = editor ? editor->gui.header_toolbar : 0; + GUI_EDITOR_TOOLBAR* tbar = (GUI_EDITOR_TOOLBAR*)toolbar; + U8 menu_open = tbar && ( tbar->file_open || tbar->edit_open ); + F32 saved_mx = input.mouse.pos.x; + F32 saved_my = input.mouse.pos.y; + if( menu_open ) { + editor_menu_hover_mask_active = 1; + editor_menu_hover_real_x = (I32)saved_mx; + editor_menu_hover_real_y = (I32)saved_my; + input.mouse.pos.x = -100000.f; + input.mouse.pos.y = -100000.f; + } else { + editor_menu_hover_mask_active = 0; + } CLR clr = gui_is_fg_window( wnd )? ui_clr.border : ui_clr.border_inactive; gui_draw_frect( wnd->x, wnd->y, wnd->w, wnd->h, clr ); @@ -808,6 +1097,32 @@ void gui_editorwindow_draw_fn( void* ptr ) { if( it->draw_fn ) it->draw_fn( it ); else dlog( "gui_editorwindow_draw_fn(): child %p has no draw_fn", it ); } ); + + input.mouse.pos.x = saved_mx; + input.mouse.pos.y = saved_my; + editor_menu_hover_mask_active = 0; +} + +static void gui_editorwindow_input_fn( void* ptr ) { + GUI_EDITORWINDOW* wnd = (GUI_EDITORWINDOW*)ptr; + editor_raise_header_toolbar( editor ); + + GUI_BASE* toolbar = editor ? editor->gui.header_toolbar : 0; + if( toolbar && toolbar->enabled && toolbar->input_fn ) + toolbar->input_fn( toolbar ); + + GUI_EDITOR_TOOLBAR* tbar = (GUI_EDITOR_TOOLBAR*)toolbar; + U8 menu_open = tbar && ( tbar->file_open || tbar->edit_open ); + if( menu_open ) + return; + + wnd->children.each( fn( GUI_BASE** childptr ) { + GUI_BASE* child = *childptr; + if( !child || child == toolbar || !child->enabled || !child->input_fn ) + return; + + child->input_fn( child ); + } ); } GUI_EDITORWINDOW* gui_editorwindow_create( I32 w, I32 h ) { @@ -818,6 +1133,7 @@ GUI_EDITORWINDOW* gui_editorwindow_create( I32 w, I32 h ) { wnd->ybound = wnd->h = h; wnd->locked = 1; wnd->draw_fn = gui_editorwindow_draw_fn; + wnd->input_fn = gui_editorwindow_input_fn; strcpy( wnd->name, "EDITORWINDOW" ); _gui.windows.push( wnd ); @@ -933,9 +1249,9 @@ void editor_create_map_view( GAME_EDITOR* e ) { e->gui.assets = 0; e->gui.status = 0; e->gui.assets_scroll = 0; + e->gui.header_toolbar = 0; e->gui.header_viewtype_label = 0; e->gui.header_back = 0; - e->gui.header_save = 0; e->gui.header_mode_2d = 0; e->gui.header_mode_3d = 0; e->gui.header_mode_sim = 0; |
