diff options
| author | kasull <qsullian@gmail.com> | 2026-03-01 20:18:08 -0500 |
|---|---|---|
| committer | kasull <qsullian@gmail.com> | 2026-03-01 20:18:08 -0500 |
| commit | 413ef78504278d37080b9b59a652e4bbd5e2a0fc (patch) | |
| tree | 67be817cf765725dd2d08c14b2d0ce8c12b20997 /src/editor/editor.cpp | |
| parent | 71dd7fcccb45a54d85ae23a95a8a8905ed21fe15 (diff) | |
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
Diffstat (limited to 'src/editor/editor.cpp')
| -rw-r--r-- | src/editor/editor.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
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" ); |
