summaryrefslogtreecommitdiff
path: root/src/editor
diff options
context:
space:
mode:
authoraura <nw@moneybot.cc>2026-03-10 01:35:50 +0100
committeraura <nw@moneybot.cc>2026-03-10 01:35:50 +0100
commit8329d42d3e592f4cd42cdfa586e2325ddc76c898 (patch)
treedec7e2a733bfc6b6384936c1f3ed067a42b59bb9 /src/editor
parent8ae8c85e9d3806cdb726e07f37e1b49484c5c48e (diff)
perf profiler, simplify 2d render, string struct, many small things
Diffstat (limited to 'src/editor')
-rw-r--r--src/editor/editor_gui_internal.h52
-rw-r--r--src/editor/editor_infobox.cpp4
-rw-r--r--src/editor/editor_menubar.cpp12
-rw-r--r--src/editor/editor_window.cpp6
4 files changed, 39 insertions, 35 deletions
diff --git a/src/editor/editor_gui_internal.h b/src/editor/editor_gui_internal.h
index ff9b140..ff20a98 100644
--- a/src/editor/editor_gui_internal.h
+++ b/src/editor/editor_gui_internal.h
@@ -3,31 +3,31 @@
#include "editor.h"
#include "../util.h"
-constexpr I32 EDITOR_LAYOUT_MARGIN = 10;
-constexpr I32 EDITOR_LAYOUT_TITLE_OFFSET = 15;
-constexpr I32 EDITOR_LAYOUT_MENU_Y = 1;
-constexpr I32 EDITOR_LAYOUT_MENU_H = 22;
-constexpr I32 EDITOR_LAYOUT_NAV_Y = EDITOR_LAYOUT_MENU_Y + EDITOR_LAYOUT_MENU_H + 4;
-constexpr I32 EDITOR_LAYOUT_CONTENT_Y = EDITOR_LAYOUT_NAV_Y + 28;
-constexpr I32 EDITOR_LAYOUT_COLUMN_GAP = 10;
-constexpr I32 EDITOR_LAYOUT_VIEW_TOOL_GAP = 17;
-constexpr I32 EDITOR_LAYOUT_TOOL_BTN_TOP_GAP = 3;
-constexpr I32 EDITOR_LAYOUT_TOOL_PANEL_GAP = 5;
-constexpr I32 EDITOR_LAYOUT_LEFT_BOX_GAP = 10;
-constexpr I32 EDITOR_LAYOUT_STATUS_H = 22;
-constexpr I32 EDITOR_LAYOUT_STATUS_GAP = 6;
-constexpr I32 EDITOR_LAYOUT_TOOL_PANEL_W = 300;
-constexpr I32 EDITOR_LAYOUT_TOOL_PANEL_H = 150;
-constexpr I32 EDITOR_LAYOUT_PROPS_DEFAULT_W = 300;
-constexpr I32 EDITOR_LAYOUT_PROPS_DEFAULT_H = 300;
-constexpr I32 EDITOR_LAYOUT_VIEW_DEFAULT_H = 370;
-constexpr I32 EDITOR_LAYOUT_PROPS_MIN_W = 200;
-constexpr I32 EDITOR_LAYOUT_PROPS_MIN_H = 120;
-constexpr I32 EDITOR_LAYOUT_ASSETS_MIN_H = 120;
-constexpr I32 EDITOR_LAYOUT_VIEW_MIN_H = 140;
-constexpr I32 EDITOR_LAYOUT_RIGHT_MIN_W = 260;
-
-constexpr I32 EDITOR_TOOLBAR_DROPDOWN_W = 120;
+const I32 EDITOR_LAYOUT_MARGIN = 10;
+const I32 EDITOR_LAYOUT_TITLE_OFFSET = 15;
+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;
+const I32 EDITOR_LAYOUT_TOOL_PANEL_GAP = 5;
+const I32 EDITOR_LAYOUT_LEFT_BOX_GAP = 10;
+const I32 EDITOR_LAYOUT_STATUS_H = 22;
+const I32 EDITOR_LAYOUT_STATUS_GAP = 6;
+const I32 EDITOR_LAYOUT_TOOL_PANEL_W = 300;
+const I32 EDITOR_LAYOUT_TOOL_PANEL_H = 150;
+const I32 EDITOR_LAYOUT_PROPS_DEFAULT_W = 300;
+const I32 EDITOR_LAYOUT_PROPS_DEFAULT_H = 300;
+const I32 EDITOR_LAYOUT_VIEW_DEFAULT_H = 370;
+const I32 EDITOR_LAYOUT_PROPS_MIN_W = 200;
+const I32 EDITOR_LAYOUT_PROPS_MIN_H = 120;
+const I32 EDITOR_LAYOUT_ASSETS_MIN_H = 120;
+const I32 EDITOR_LAYOUT_VIEW_MIN_H = 140;
+const I32 EDITOR_LAYOUT_RIGHT_MIN_W = 260;
+
+const I32 EDITOR_TOOLBAR_DROPDOWN_W = 120;
extern U8 editor_menu_hover_mask_active;
extern I32 editor_menu_hover_real_x;
@@ -52,4 +52,4 @@ extern void editor_create_auxiliary_panels( GAME_EDITOR* e );
extern void editor_update_toolview( GAME_EDITOR* e );
extern void editor_create_toolview_column( GAME_EDITOR* e );
extern void editor_create_game_view_column( GAME_EDITOR* e );
-extern void settool( U8 t );
+extern void editor_settool( U8 t );
diff --git a/src/editor/editor_infobox.cpp b/src/editor/editor_infobox.cpp
index 8e455d9..931d9ea 100644
--- a/src/editor/editor_infobox.cpp
+++ b/src/editor/editor_infobox.cpp
@@ -150,9 +150,9 @@ static void gui_editor_infobox_draw_fn( void* ptr ) {
ALIGN_R,
FNT_JPN12,
ui_clr.txt,
- "fps: %.3f (%.5f ms) %dx%d",
+ "fps: %.0f (%.2f ms) %dx%d",
gl->fps,
- gl->frametime,
+ gl->frametime * 1000.f,
gl->canvas_size[0],
gl->canvas_size[1]
);
diff --git a/src/editor/editor_menubar.cpp b/src/editor/editor_menubar.cpp
index 5491c05..c15053f 100644
--- a/src/editor/editor_menubar.cpp
+++ b/src/editor/editor_menubar.cpp
@@ -267,12 +267,12 @@ static void editor_toolbar_invoke( const EDITOR_MENUBAR_ENTRY* root, const EDITO
return;
}
if( !strcmp( root->text, "tools" ) ) {
- if( !strcmp( entry->text, "none" ) ) settool( EDITOR_TOOL_NONE );
- else if( !strcmp( entry->text, "select" ) ) settool( EDITOR_TOOL_SELECT );
- else if( !strcmp( entry->text, "wall" ) ) settool( EDITOR_TOOL_WALL );
- else if( !strcmp( entry->text, "poly" ) ) settool( EDITOR_TOOL_POLY );
- else if( !strcmp( entry->text, "sprite" ) ) settool( EDITOR_TOOL_SPRITE );
- else if( !strcmp( entry->text, "ent" ) ) settool( EDITOR_TOOL_ENT );
+ if( !strcmp( entry->text, "none" ) ) editor_settool( EDITOR_TOOL_NONE );
+ else if( !strcmp( entry->text, "select" ) ) editor_settool( EDITOR_TOOL_SELECT );
+ else if( !strcmp( entry->text, "wall" ) ) editor_settool( EDITOR_TOOL_WALL );
+ else if( !strcmp( entry->text, "poly" ) ) editor_settool( EDITOR_TOOL_POLY );
+ else if( !strcmp( entry->text, "sprite" ) ) editor_settool( EDITOR_TOOL_SPRITE );
+ else if( !strcmp( entry->text, "ent" ) ) editor_settool( EDITOR_TOOL_ENT );
}
}
diff --git a/src/editor/editor_window.cpp b/src/editor/editor_window.cpp
index 51ca67d..bd70418 100644
--- a/src/editor/editor_window.cpp
+++ b/src/editor/editor_window.cpp
@@ -108,7 +108,7 @@ void editor_update_toolview( GAME_EDITOR* e ) {
gui_editor_toolview_update( egui->tool );
}
-void settool( U8 t ) {
+void editor_settool( U8 t ) {
editor->tool.type = t;
if( editor->gui.v2d )
editor->gui.v2d->poly_drag = 0;
@@ -116,6 +116,10 @@ void settool( U8 t ) {
editor_update_toolview( editor );
}
+void settool( U8 t ) {
+ editor_settool( t );
+}
+
const char* editor_tool_name() {
switch( editor->tool.type ) {
case EDITOR_TOOL_SELECT: return "select";