From 413ef78504278d37080b9b59a652e4bbd5e2a0fc Mon Sep 17 00:00:00 2001 From: kasull Date: Sun, 1 Mar 2026 20:18:08 -0500 Subject: editor ui rework add responsive editor relayout for window resize rework header with back/save, view mode buttons, and 2d view type selector add clipped, scrollable assets and contextual tool panels simplify tool button wiring and repeated layout logic simplify 2d top-down editor internals and shared grid update hooks --- src/editor/editor.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'src/editor/editor.cpp') diff --git a/src/editor/editor.cpp b/src/editor/editor.cpp index ad23d1e..3c67ecd 100644 --- a/src/editor/editor.cpp +++ b/src/editor/editor.cpp @@ -4,6 +4,36 @@ GAME_EDITOR* editor = 0; +void editor_register_grid_dependency( GAME_EDITOR* e, void* tag, EDITOR_GRID_DEP_CALLBACK cb ) { + if( !e || !tag || !cb ) + return; + + I32 idx = e->grid_dependencies.idx_where( fn( GAME_EDITOR::GRID_DEPENDENCY* dep ) { + return dep->tag == tag; + } ); + + if( idx != -1 ) { + e->grid_dependencies[idx].cb = cb; + return; + } + + GAME_EDITOR::GRID_DEPENDENCY dep; + dep.tag = tag; + dep.cb = cb; + e->grid_dependencies.push( dep ); +} + +void editor_notify_grid_change( GAME_EDITOR* e ) { + if( !e ) + return; + + e->grid_dependencies.each( fn( GAME_EDITOR::GRID_DEPENDENCY* dep ) { + if( dep->cb ) { + dep->cb( e ); + } + } ); +} + GAME_EDITOR* editor_create( GAME_DATA* game ) { if( editor ) { dlog( "editor_create() : attempted to create editor when one already exists\n" ); -- cgit v1.2.3