WIP: Stuff related to working on the settings menu + more

Moved core ui to its own folder.
Worked on theming (proper light and dark theme)
Began to work on the scroll box widget and input box constructions

I added back a script for flattening the codebase: gen_flattened_codebase.ps1
This commit is contained in:
2024-05-19 01:21:51 -04:00
parent ddff1fcae6
commit b137bc542c
30 changed files with 1420 additions and 664 deletions

View File

@ -60,7 +60,7 @@ startup :: proc( prof : ^SpallProfiler, persistent_mem, frame_mem, transient_mem
Memory_App.state = state
using state
// Setup Persistent Slab
// Setup Persistent Slabs & String Cache
{
alignment := uint(mem.DEFAULT_ALIGNMENT)
@ -93,14 +93,24 @@ startup :: proc( prof : ^SpallProfiler, persistent_mem, frame_mem, transient_mem
verify( alloc_error == .None, "Failed to allocate transient slab" )
transient_clear_time = 120 // Seconds, 2 Minutes
string_cache = str_cache_init()
}
string_cache = str_cache_init()
// Setup input frame poll references
input = & input_data[1]
input_prev = & input_data[0]
for & input in input_data {
using input
error : AllocatorError
keyboard_events.keys_pressed, error = array_init_reserve(KeyboardKey, persistent_slab_allocator(), Kilo)
ensure(error == AllocatorError.None, "Failed to allocate input.keyboard_events.keys_pressed array")
keyboard_events.chars_pressed, error = array_init_reserve(rune, persistent_slab_allocator(), Kilo)
ensure(error == AllocatorError.None, "Failed to allocate input.keyboard_events.chars_pressed array")
}
// Configuration Load
// TODO(Ed): Make this actually load from an ini
{
using config
resolution_width = 1000
@ -119,6 +129,8 @@ startup :: proc( prof : ^SpallProfiler, persistent_mem, frame_mem, transient_mem
timing_fps_moving_avg_alpha = 0.9
ui_resize_border_width = 5
color_theme = App_Thm_Dusk
}
Desired_OS_Scheduler_MS :: 1
@ -182,6 +194,7 @@ startup :: proc( prof : ^SpallProfiler, persistent_mem, frame_mem, transient_mem
}
// Demo project setup
// TODO(Ed): This will eventually have to occur when the user either creates or loads a workspace. I don't know
{
using project
path = str_intern("./")
@ -318,10 +331,12 @@ tick :: proc( host_delta_time : f64, host_delta_ns : Duration ) -> b32
rl.PollInputEvents()
debug.draw_ui_box_bounds_points = true
debug.draw_ui_box_bounds_points = false
debug.draw_UI_padding_bounds = false
debug.draw_ui_content_bounds = true
debug.draw_ui_content_bounds = false
config.color_theme = App_Thm_Light
// config.color_theme = App_Thm_Dusk
should_close = update( host_delta_time )
render()

View File

@ -43,7 +43,7 @@ render :: proc()
render_mode_3d()
rl.BeginDrawing()
rl.ClearBackground( Color_ThmDark_BG )
rl.ClearBackground( app_color_theme().bg )
render_mode_2d_workspace()
render_mode_screenspace()
@ -252,7 +252,7 @@ render_mode_screenspace :: proc ()
{
// debug_text( "Screen Width : %v", rl.GetScreenWidth () )
// debug_text( "Screen Height: %v", rl.GetScreenHeight() )
debug_text( "frametime_target_ms : %f ms", frametime_target_ms )
// debug_text( "frametime_target_ms : %f ms", frametime_target_ms )
debug_text( "frametime : %f ms", frametime_delta_ms )
// debug_text( "frametime_last_elapsed_ms : %f ms", frametime_elapsed_ms )
if replay.mode == ReplayMode.Record {
@ -261,10 +261,9 @@ render_mode_screenspace :: proc ()
if replay.mode == ReplayMode.Playback {
debug_text( "Replaying Input")
}
// debug_text("Zoom Target: %v", project.workspace.zoom_target)
}
debug_text("Zoom Target: %v", project.workspace.zoom_target)
if debug.mouse_vis {
debug_text("Mouse Vertical Wheel: %v", input.mouse.vertical_wheel )
debug_text("Mouse Delta : %v", input.mouse.delta )
@ -277,34 +276,39 @@ render_mode_screenspace :: proc ()
ui := & project.workspace.ui
debug_text("Box Count (Workspace): %v", ui.built_box_count )
if false
{
debug_text("Box Count (Workspace): %v", ui.built_box_count )
hot_box := ui_box_from_key( ui.curr_cache, ui.hot )
active_box := ui_box_from_key( ui.curr_cache, ui.active )
if hot_box != nil {
debug_text("Worksapce Hot Box : %v", hot_box.label.str )
debug_text("Workspace Hot Range2: %v", hot_box.computed.bounds.pts)
}
if active_box != nil{
debug_text("Workspace Active Box: %v", active_box.label.str )
hot_box := ui_box_from_key( ui.curr_cache, ui.hot )
active_box := ui_box_from_key( ui.curr_cache, ui.active )
if hot_box != nil {
debug_text("Worksapce Hot Box : %v", hot_box.label.str )
debug_text("Workspace Hot Range2: %v", hot_box.computed.bounds.pts)
}
if active_box != nil{
debug_text("Workspace Active Box: %v", active_box.label.str )
}
}
ui = & screen_ui
debug_text("Box Count: %v", ui.built_box_count )
if true
{
debug_text("Box Count: %v", ui.built_box_count )
hot_box = ui_box_from_key( ui.curr_cache, ui.hot )
active_box = ui_box_from_key( ui.curr_cache, ui.active )
if hot_box != nil {
debug_text("Hot Box : %v", hot_box.label.str )
debug_text("Hot Range2: %v", hot_box.computed.bounds.pts)
}
if active_box != nil{
debug_text("Active Box: %v", active_box.label.str )
hot_box := ui_box_from_key( ui.curr_cache, ui.hot )
active_box := ui_box_from_key( ui.curr_cache, ui.active )
if hot_box != nil {
debug_text("Hot Box : %v", hot_box.label.str )
debug_text("Hot Range2: %v", hot_box.computed.bounds.pts)
}
if active_box != nil{
debug_text("Active Box: %v", active_box.label.str )
}
}
view := view_get_bounds()
debug.draw_debug_text_y = 14
// Define the triangle vertices and colors

View File

@ -239,7 +239,7 @@ update :: proc( delta_time : f64 ) -> b32
// test_hover_n_click()
// test_draggable()
// test_text_box()
test_parenting( & default_layout, & frame_style_default )
// test_parenting( & default_layout, & frame_style_default )
// test_whitespace_ast( & default_layout, & frame_style_default )
}
//endregion Workspace Imgui Tick