minor changes, prepping for next tasks

This commit is contained in:
Edward R. Gonzalez 2024-05-11 01:30:54 -04:00
parent e40e3ddf85
commit 6a4f7ac6de
10 changed files with 37 additions and 24 deletions

View File

@ -190,7 +190,7 @@ startup :: proc( prof : ^SpallProfiler, persistent_mem, frame_mem, transient_mem
log( "Default font loaded" )
}
// Setup the app ui state
// Setup the screen ui state
{
ui_startup( & screen_ui.base, cache_allocator = persistent_slab_allocator() )
@ -348,7 +348,7 @@ tick :: proc( host_delta_time : f64, host_delta_ns : Duration ) -> b32
{
// profile("Client tick timing processing")
config.engine_refresh_hz = uint(monitor_refresh_hz)
// config.engine_refresh_hz = 30
// config.engine_refresh_hz = 10
frametime_target_ms = 1.0 / f64(config.engine_refresh_hz) * S_To_MS
sub_ms_granularity_required := frametime_target_ms <= Frametime_High_Perf_Threshold_MS

1
code/input_actions.odin Normal file
View File

@ -0,0 +1 @@
package sectr

1
code/input_event.odin Normal file
View File

@ -0,0 +1 @@
package sectr

View File

@ -221,7 +221,7 @@ render_mode_screenspace :: proc ()
cam := & project.workspace.cam
win_extent := state.app_window.extent
render_app_ui()
render_screen_ui()
fps_msg := str_fmt_tmp( "FPS: %f", fps_avg)
fps_msg_width := measure_text_size( fps_msg, default_font, 16.0, 0.0 ).x
@ -314,7 +314,7 @@ render_mode_screenspace :: proc ()
// A non-zoomable static-view for ui
// Only a scalar factor may be applied to the size of widgets & fonts
// 'Window tiled' panels reside here
render_app_ui :: proc()
render_screen_ui :: proc()
{
profile(#procedure)

View File

@ -79,6 +79,7 @@ UI_BoxFlag_Scroll :: UI_BoxFlags { .Scroll_X, .Scroll_Y }
// The UI_Box's actual positioning and sizing
// There is an excess of rectangles here for debug puproses.
UI_Computed :: struct {
fresh : b32, // If the auto-layout has been computed for the current frame
anchors : Range2, // Bounds for anchors within parent
margins : Range2, // Bounds for margins within parent
bounds : Range2, // Bounds for box itself
@ -268,10 +269,11 @@ ui_box_make :: proc( flags : UI_BoxFlags, label : string ) -> (^ UI_Box)
curr_box.flags = flags
// Clear old links
curr_box.parent = nil
curr_box.links = {}
curr_box.num_children = 0
// Clear non-persistent data
curr_box.computed.fresh = false
curr_box.parent = nil
curr_box.links = {}
curr_box.num_children = 0
// If there is a parent, setup the relevant references
parent := stack_peek( & parent_stack )

View File

@ -23,6 +23,9 @@ ui_compute_layout :: proc( ui : ^UI_State )
current := root.first
for ; current != nil;
{
// if current.computed.fresh do return
// TODO(Ed): Lift this to ui_box_compute_layout
// profile("Layout Box")
style := current.style
@ -174,6 +177,7 @@ ui_compute_layout :: proc( ui : ^UI_State )
computed.text_size = text_size
computed.text_pos = { text_pos.x, text_pos.y }
}
computed.fresh = true
current = ui_box_tranverse_next( current )
}

View File

@ -27,11 +27,11 @@ ui_screen_tick :: proc() {
ui_graph_build( & screen_ui )
ui := ui_context
ui_app_menu_bar()
ui_app_settings_menu()
ui_screen_menu_bar()
ui_screen_settings_menu()
}
ui_app_menu_bar :: proc()
ui_screen_menu_bar :: proc()
{
profile("App Menu Bar")
fmt :: str_fmt_alloc
@ -104,7 +104,7 @@ ui_app_menu_bar :: proc()
}
}
ui_app_settings_menu :: proc()
ui_screen_settings_menu :: proc()
{
profile("Settings Menu")
using state := get_state()
@ -171,13 +171,13 @@ ui_app_settings_menu :: proc()
}
}
ui_hbox_end(frame_bar, & size.x)
ui_hbox_end(frame_bar)//, & size.x)
}
spacer := ui_spacer("Settings Menu: Spacer")
spacer.style.anchor.ratio.y = 1.0
ui_vbox_end(container, & size.y)
ui_vbox_end(container)//, & size.y)
}
ui_resizable_handles( & container, & pos, & size )

View File

@ -72,6 +72,8 @@ ui_signal_from_box :: proc ( box : ^ UI_Box, update_style := true, update_deltas
if mouse_clickable && signal.cursor_over && left_pressed && was_hot
{
//TODO(Ed): We need to add the reorder of top-level widgets based on this interaction
// runtime.debug_trap()
// ui.hot = box.key
ui.active = box.key

View File

@ -122,8 +122,9 @@ ui_hbox_end :: proc( hbox : UI_HBox, width_ref : ^f32 = nil ) {
// Auto-layout children and pop parent from parent stack
ui_hbox_end_pop_parent :: proc( hbox : UI_HBox ) {
ui_hbox_end(hbox)
// ui_box_compute_layout(hox.widget)
ui_parent_pop()
ui_hbox_end(hbox)
}
@(deferred_out = ui_hbox_end_pop_parent)
@ -135,6 +136,7 @@ ui_hbox :: #force_inline proc( direction : UI_LayoutDirectionX, label : string,
//endregion Horizontal Box
// Adds resizable handles to a widget
// TODO(Ed): Add centered resize support (use center alignment on shift-click)
ui_resizable_handles :: proc( parent : ^UI_Widget,
pos, size : ^Vec2,
handle_width : f32 = 15,
@ -429,8 +431,9 @@ ui_vbox_end :: proc( vbox : UI_VBox, height_ref : ^f32 = nil ) {
// Auto-layout children and pop parent from parent stack
ui_vbox_end_pop_parent :: proc( vbox : UI_VBox ) {
ui_vbox_end(vbox)
// ui_box_compute_layout(vbox)
ui_parent_pop()
ui_vbox_end(vbox)
}
@(deferred_out = ui_vbox_end_pop_parent)

View File

@ -167,10 +167,10 @@ push-location $path_root
$build_args += $flag_output_path + $module_dll
$build_args += ($flag_collection + $pkg_collection_thirdparty)
# $build_args += $flag_micro_architecture_native
# $build_args += $flag_use_separate_modules
# $build_args += $flag_thread_count + $CoreCount_Physical
# $build_args += $flag_optimize_none
$build_args += $flag_optimize_minimal
$build_args += $flag_use_separate_modules
$build_args += $flag_thread_count + $CoreCount_Physical
$build_args += $flag_optimize_none
# $build_args += $flag_optimize_minimal
# $build_args += $flag_optimize_speed
# $build_args += $falg_optimize_aggressive
$build_args += $flag_debug
@ -249,10 +249,10 @@ push-location $path_root
$build_args += $flag_output_path + $executable
$build_args += ($flag_collection + $pkg_collection_thirdparty)
# $build_args += $flag_micro_architecture_native
# $build_args += $flag_use_separate_modules
# $build_args += $flag_thread_count + $CoreCount_Physical
# $build_args += $flag_optimize_none
$build_args += $flag_optimize_minimal
$build_args += $flag_use_separate_modules
$build_args += $flag_thread_count + $CoreCount_Physical
$build_args += $flag_optimize_none
# $build_args += $flag_optimize_minimal
# $build_args += $flag_optimize_speed
# $build_args += $falg_optimize_aggressive
$build_args += $flag_debug