From 2f2253f12ce67fd9091c4c74d1ff55aad5281c0f Mon Sep 17 00:00:00 2001 From: Ed_ Date: Mon, 30 Dec 2024 19:39:41 -0500 Subject: [PATCH] misc changes * Decided to not have a state scope (going to be more ganular) * Fixes to settings_menu (prepping to convert to window after log scope is done) --- code/sectr/app/logger_scope.odin | 2 +- code/sectr/app/screen.odin | 14 +++++++------- code/sectr/app/settings_menu.odin | 20 ++++++++++++-------- code/sectr/app/state_scope.odin | 12 ------------ code/sectr/engine/client_api.odin | 10 +++++----- code/sectr/math/math.odin | 2 ++ 6 files changed, 27 insertions(+), 33 deletions(-) delete mode 100644 code/sectr/app/state_scope.odin diff --git a/code/sectr/app/logger_scope.odin b/code/sectr/app/logger_scope.odin index 9b0f4dc..773740f 100644 --- a/code/sectr/app/logger_scope.odin +++ b/code/sectr/app/logger_scope.odin @@ -13,7 +13,7 @@ ui_logger_scope_builder :: proc( captures : rawptr = nil ) -> ( should_raise : b using logger_scope scope(theme_window_panel) - dragged, resized, maximized := ui_window_begin( & window, "Logger Scope: Window") + dragged, resized, maximized, closed := ui_window( & window, "Logger Scope: Window", str_intern("Log Scope"), child_layout = .Top_To_Bottom ) should_raise |= dragged | resized | maximized return diff --git a/code/sectr/app/screen.odin b/code/sectr/app/screen.odin index 4f670ca..5fc4353 100644 --- a/code/sectr/app/screen.odin +++ b/code/sectr/app/screen.odin @@ -1,12 +1,5 @@ package sectr -UI_ScreenMenuBar :: struct { - pos, size : Vec2, - container : UI_HBox, - logger_scope_btn : UI_Widget, - settings_btn : UI_Widget -} - UI_ScreenState :: struct { using base : UI_State, @@ -40,6 +33,13 @@ ui_screen_tick :: proc( screen_ui : ^UI_ScreenState ) { ui_floating("Settings Menu", & screen_ui.settings_menu, ui_settings_menu_builder) } +UI_ScreenMenuBar :: struct { + pos, size : Vec2, + container : UI_HBox, + logger_scope_btn : UI_Widget, + settings_btn : UI_Widget +} + ui_screen_menu_bar_builder :: proc( captures : rawptr = nil ) -> (should_raise : b32 = false ) { profile("App Menu Bar") diff --git a/code/sectr/app/settings_menu.odin b/code/sectr/app/settings_menu.odin index dc778fa..83790c4 100644 --- a/code/sectr/app/settings_menu.odin +++ b/code/sectr/app/settings_menu.odin @@ -2,7 +2,7 @@ package sectr UI_SettingsMenu :: struct { - container : UI_Widget, + // using window : UI_Window, engine_refresh_inputbox : UI_TextInputBox, min_zoom_inputbox : UI_TextInputBox, max_zoom_inputbox : UI_TextInputBox, @@ -14,6 +14,9 @@ UI_SettingsMenu :: struct font_size_screen_scalar_input : UI_TextInputBox, cfg_drop_down : UI_DropDown, zoom_mode_drop_down : UI_DropDown, + + // Window + container : UI_Widget, pos, size, min_size : Vec2, is_open : b32, is_maximized : b32, @@ -28,11 +31,13 @@ ui_settings_menu_builder :: proc( captures : rawptr = nil ) -> ( should_raise : app_color := app_color_theme() using settings_menu - if size.x < min_size.x do size.x = min_size.x - if size.y < min_size.y do size.y = min_size.y + if size.x < settings_menu.min_size.x do size.x = settings_menu.min_size.x + if size.y < settings_menu.min_size.y do size.y = settings_menu.min_size.y scope(theme_window_panel) + // ui_window(& window, "settings_menu.window", ) container = ui_widget("Settings Menu: Window", {}); + // when false setup_container: { using container @@ -74,7 +79,7 @@ ui_settings_menu_builder :: proc( captures : rawptr = nil ) -> ( should_raise : } } } - ui_parent_push(container) + ui_parent(container) vbox := ui_vbox_begin( .Top_To_Bottom, "Settings Menu: VBox", {.Mouse_Clickable}, compute_layout = true ) { @@ -121,12 +126,13 @@ ui_settings_menu_builder :: proc( captures : rawptr = nil ) -> ( should_raise : } // TODO(Ed): This will eventually be most likely generalized/compressed. For now its the main scope for implementing new widgets. - dd_app_config := ui_drop_down( & cfg_drop_down, "settings_menu.config", str_intern("App Config"), vb_compute_layout = true); + dd_app_config := ui_drop_down( & cfg_drop_down, "settings_menu.dd_app_config", str_intern("App Config"), vb_compute_layout = true); app_config_closed: { dd_app_config.title.layout.font_size = 12 should_raise |= cast(b32) dd_app_config.btn.active if ! dd_app_config.is_open do break app_config_closed + ui_size_to_content_y( dd_app_config.vbox) ui_settings_entry_inputbox :: proc( input_box : ^UI_TextInputBox, is_even : bool, label : string, setting_title : StrRunesPair, input_policy : UI_TextInput_Policy ) { @@ -158,7 +164,7 @@ ui_settings_menu_builder :: proc( captures : rawptr = nil ) -> ( should_raise : } } - config := app_config() + config := & get_state().config Engine_Refresh_Hz: { @@ -547,8 +553,6 @@ ui_settings_menu_builder :: proc( captures : rawptr = nil ) -> ( should_raise : } } ui_vbox_end(vbox, compute_layout = false ) - - ui_parent_pop() // container return } diff --git a/code/sectr/app/state_scope.odin b/code/sectr/app/state_scope.odin deleted file mode 100644 index dbaf72f..0000000 --- a/code/sectr/app/state_scope.odin +++ /dev/null @@ -1,12 +0,0 @@ -package sectr - -UI_StateScope :: struct -{ - -} - -ui_state_scope :: proc( captures : rawptr = nil ) -> ( should_raise : b32 = false ) -{ - profile("State Scope") - return -} diff --git a/code/sectr/engine/client_api.odin b/code/sectr/engine/client_api.odin index f2efae5..24f489e 100644 --- a/code/sectr/engine/client_api.odin +++ b/code/sectr/engine/client_api.odin @@ -152,8 +152,8 @@ startup :: proc( prof : ^SpallProfiler, persistent_mem, frame_mem, transient_mem color_theme = App_Thm_Dusk - font_size_screen_scalar = 1.0 - font_size_canvas_scalar = 1.0 + font_size_screen_scalar = 2.0 + font_size_canvas_scalar = 2.0 } Desired_OS_Scheduler_MS :: 1 @@ -519,12 +519,12 @@ tick_work_frame :: #force_inline proc( host_delta_time_ms : f64 ) -> b32 // rl.PollInputEvents() - config := app_config() + config := & get_state().config debug := & get_state().debug - debug.draw_ui_box_bounds_points = false + debug.draw_ui_box_bounds_points = true debug.draw_ui_padding_bounds = false - debug.draw_ui_content_bounds = false + debug.draw_ui_content_bounds = true // config.engine_refresh_hz = 165 diff --git a/code/sectr/math/math.odin b/code/sectr/math/math.odin index 37c505a..8e3a731 100644 --- a/code/sectr/math/math.odin +++ b/code/sectr/math/math.odin @@ -75,6 +75,8 @@ vec3i_to_vec3 :: #force_inline proc "contextless" (v : Vec3i) -> Vec3 {return tr #region("Range2") +// TODO(Ed): I rather keep the different usages as different types, then type coerece their procedure mappings +// to support the base p0, p1 range Range2 :: struct #raw_union { using min_max : struct { min, max : Vec2,