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)
This commit is contained in:
Edward R. Gonzalez 2024-12-30 19:39:41 -05:00
parent c2476ab854
commit 2f2253f12c
6 changed files with 27 additions and 33 deletions

View File

@ -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

View File

@ -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")

View File

@ -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
}

View File

@ -1,12 +0,0 @@
package sectr
UI_StateScope :: struct
{
}
ui_state_scope :: proc( captures : rawptr = nil ) -> ( should_raise : b32 = false )
{
profile("State Scope")
return
}

View File

@ -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

View File

@ -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,