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

@ -52,12 +52,13 @@ ui_screen_menu_bar :: proc( captures : rawptr = nil ) -> (should_raise : b32 = f
{
@static theme : UI_Theme
@static loaded : b32 = false
if true && ! loaded
if ! loaded
{
app_color := app_color_theme()
layout := UI_Layout {
flags = {},
anchor = range2({},{}),
alignment = {0.5, 0.5},
// alignment = UI_Align_Presets.text_centered,
text_alignment = {0.0, 1.5},
font_size = 12,
margins = {0, 0, 0, 0},
@ -67,34 +68,30 @@ ui_screen_menu_bar :: proc( captures : rawptr = nil ) -> (should_raise : b32 = f
size = range2({},{})
}
style := UI_Style {
bg_color = Color_ThmDark_BG,
border_color = Color_ThmDark_Border_Default,
bg_color = app_color.bg,
border_color = app_color.border_default,
corner_radii = {},
blur_size = 0,
font = get_state().default_font,
text_color = Color_ThmDark_Text_Default,
text_color = app_color.text_default,
cursor = {},
}
// loaded = true
layout_combo := to_ui_layout_combo(layout)
style_combo := to_ui_style_combo(style)
{
Hot: {
using layout_combo.hot
using style_combo.hot
bg_color = Color_ThmDark_Btn_BG_Hot
text_color = Color_ThmDark_Text_Hot
bg_color = app_color.btn_bg_hot
text_color = app_color.text_hot
}
{
Active: {
using layout_combo.active
using style_combo.active
bg_color = Color_ThmDark_Btn_BG_Active
text_color = Color_ThmDark_Text_Active
}
theme = UI_Theme {
layout_combo, style_combo
bg_color = app_color.btn_bg_active
text_color = app_color.text_active
}
theme = UI_Theme { layout_combo, style_combo }
loaded = true
}
ui_layout_push(theme.layout)
ui_style_push(theme.style)
@ -105,7 +102,8 @@ ui_screen_menu_bar :: proc( captures : rawptr = nil ) -> (should_raise : b32 = f
{
using screen_ui.menu_bar
ui_theme_app_menu_bar_default()
container = ui_hbox( .Left_To_Right, "Menu Bar" )
container = ui_hbox_begin( .Left_To_Right, "Menu Bar" )
ui_parent(container)
{
using container
layout.flags = {.Fixed_Position_X, .Fixed_Position_Y, .Fixed_Width, .Fixed_Height, .Origin_At_Anchor_Center}
@ -114,7 +112,7 @@ ui_screen_menu_bar :: proc( captures : rawptr = nil ) -> (should_raise : b32 = f
text = str_intern("menu_bar")
}
ui_theme_btn_default()
ui_theme_btn()
move_box := ui_button("Move Box");
{
using move_box
@ -122,7 +120,7 @@ ui_screen_menu_bar :: proc( captures : rawptr = nil ) -> (should_raise : b32 = f
pos += input.mouse.delta
should_raise = true
}
layout.anchor.ratio.x = 0.4
layout.anchor.ratio.x = 1.0
}
spacer := ui_spacer("Menu Bar: Move Spacer")
@ -135,17 +133,18 @@ ui_screen_menu_bar :: proc( captures : rawptr = nil ) -> (should_raise : b32 = f
using settings_btn
text = str_intern("Settings")
layout.flags = {
// .Scale_Width_By_Height_Ratio,
.Fixed_Width
.Scale_Width_By_Height_Ratio,
// .Fixed_Width
}
layout.size.min.x = 100
layout.size.ratio.x = 2.0
if pressed {
screen_ui.settings_menu.is_open = true
}
}
spacer = ui_spacer("Menu Bar: End Spacer")
spacer.layout.anchor.ratio.x = 1.0
spacer.layout.anchor.ratio.x = 2.0
ui_hbox_end(container, compute_layout = false)
}
return
}
@ -156,22 +155,18 @@ ui_screen_settings_menu :: proc( captures : rawptr = nil ) -> ( should_raise : b
using state := get_state()
using state.screen_ui
if ! settings_menu.is_open do return
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
ui_theme_transparent()
container = ui_widget("Settings Menu", {})
{
ui_theme_window_panel()
container = ui_widget("Settings Menu", {}); {
using container
layout.flags = { .Fixed_Width, .Fixed_Height, .Fixed_Position_X, .Fixed_Position_Y, .Origin_At_Anchor_Center }
style.bg_color = Color_ThmDark_Translucent_Panel
style.border_color = { 0, 0, 0, 200 }
layout.alignment = {0.0, 0.0}
layout.border_width = 1.0
layout.pos = pos
layout.size = range2( size, {})
layout.flags = { .Fixed_Width, .Fixed_Height, .Fixed_Position_X, .Fixed_Position_Y, .Origin_At_Anchor_Center }
layout.pos = pos
layout.size = range2( size, {})
}
ui_parent(container)
if settings_menu.is_maximized {
@ -179,54 +174,27 @@ ui_screen_settings_menu :: proc( captures : rawptr = nil ) -> ( should_raise : b
layout.flags = {.Origin_At_Anchor_Center }
layout.pos = {}
}
should_raise |= ui_resizable_handles( & container, & pos, & size/*, compute_layout = true*/)
// ui_box_compute_layout(container)
should_raise |= ui_resizable_handles( & container, & pos, & size)
vbox := ui_vbox_begin( .Top_To_Bottom, "Settings Menu: VBox", {.Mouse_Clickable}, compute_layout = true)
{
should_raise |= b32(vbox.active)
ui_parent(vbox)
ui_layout( UI_Layout {
// font_size = 16,
// alignment = {0, 1},
})
ui_style( UI_Style {
// bg_color = Color_Transparent,
font = default_font,
text_color = Color_White,
})
ui_style_ref().hot.bg_color = Color_Blue
frame_bar := ui_hbox_begin(.Left_To_Right, "Settings Menu: Frame Bar", { .Mouse_Clickable, .Focusable, .Click_To_Focus })
ui_theme_window_bar()
frame_bar := ui_hbox_begin(.Left_To_Right, "Settings Menu: Frame Bar", { .Mouse_Clickable })
{
frame_bar.layout.flags = {.Fixed_Height}
frame_bar.layout.size.min.y = 50
ui_parent(frame_bar)
ui_layout( UI_Layout {
font_size = 18,
})
title := ui_text("Settings Menu: Title", str_intern("Settings Menu"), {.Disabled})
{
ui_theme_text()
title := ui_text("Settings Menu: Title", str_intern("Settings Menu"), {.Disabled}); {
using title
layout.anchor.ratio.x = 1.0
layout.margins = { 0, 0, 15, 0}
layout.text_alignment = {0 , 0.5}
layout.anchor.ratio.x = 1.0
layout.font_size = 16
}
ui_layout( UI_Layout {
font_size = 16,
})
ui_style(ui_style_peek())
style := ui_style_ref()
maximize_btn := ui_button("Settings Menu: Maximize Btn")
{
ui_theme_window_bar_btn()
maximize_btn := ui_button("Settings Menu: Maximize Btn"); {
using maximize_btn
layout.flags = {.Fixed_Width}
layout.size.min = {50, 50}
layout.text_alignment = {0.5, 0.5}
layout.anchor.ratio.x = 1.0
if maximize_btn.pressed {
settings_menu.is_maximized = ~settings_menu.is_maximized
should_raise = true
@ -234,19 +202,12 @@ ui_screen_settings_menu :: proc( captures : rawptr = nil ) -> ( should_raise : b
if settings_menu.is_maximized do text = str_intern("min")
else do text = str_intern("max")
}
close_btn := ui_button("Settings Menu: Close Btn")
{
close_btn := ui_button("Settings Menu: Close Btn"); {
using close_btn
text = str_intern("close")
layout.flags = {.Fixed_Width}
layout.size.min = {50, 0}
layout.text_alignment = {0.5, 0.5}
layout.anchor.ratio.x = 1.0
if close_btn.pressed {
settings_menu.is_open = false
}
if close_btn.hot do style.bg_color = app_color.window_btn_close_bg_hot
if close_btn.pressed do settings_menu.is_open = false
}
ui_hbox_end(frame_bar, compute_layout = true)
}
if frame_bar.active {
@ -254,66 +215,109 @@ ui_screen_settings_menu :: proc( captures : rawptr = nil ) -> ( should_raise : b
should_raise = true
}
// Populate settings with values from config (hardcoded for now)
ui_layout(UI_Layout {
flags = {
// .Origin_At_Anchor_Center,
// .Fixed_Height,
},
// pos = {0, 50},
// size = range2({100, 100},{}),
// alignment = {0,0},
})
ui_style( UI_Style {
// bg_color = Color_GreyRed
})
drop_down_bar := ui_hbox_begin(.Left_To_Right, "settings_menu.vbox: config drop_down_bar", {.Mouse_Clickable})
btn : UI_Widget
@static config_drop_down_open := false
ui_theme_drop_down()
drop_down_bar := ui_hbox_begin(.Left_To_Right, "settings_menu.vbox: config drop_down_bar", {.Mouse_Clickable })
{
drop_down_bar.layout.anchor.ratio.y = 0.1
ui_parent_push(drop_down_bar)
{
using drop_down_bar
text = str_intern("drop_down_bar")
// style.bg_color = { 55, 55, 55, 100 }
style.font = default_font
style.text_color = Color_White
layout.flags = {.Fixed_Height}
layout.font_size = 12
layout.text_alignment = {1, 0}
layout.size.min.y = 35
layout.anchor.ratio.y = 1.0
}
ui_parent(drop_down_bar)
btn = ui_text("pls", str_intern("Lets figure this out..."))
{
using btn
text = str_intern("Config")
style.font = default_font
style.text_color = Color_White
// layout.flags = {.Origin_At_Anchor_Center}
ui_theme_text()
title := ui_text("drop_down_bar.btn", str_intern("drop_down_bar.btn")); {
using title
text = str_intern("App Config")
style.text_color = drop_down_bar.style.text_color
layout.alignment = {0.0, 0.0}
layout.text_alignment = {0.0, 0.5}
layout.anchor.ratio.x = 1.0
layout.font_size = 12
layout.margins = {0,0, 15, 0}
layout.size.min.y = 35
}
um := ui_spacer("um...")
um.layout.anchor.ratio.x = 1.0
ui_parent_pop()
ui_hbox_end(drop_down_bar, compute_layout = true)
if drop_down_bar.pressed do config_drop_down_open = !config_drop_down_open
}
// ui_layout(UI_Layout {
if config_drop_down_open
{
{
ui_theme_table_row(is_even = false)
hb := ui_hbox(.Left_To_Right, "settings_menu.engine_refresh_hz.hb"); { using hb
layout.size.min = {0, 30}
layout.flags = {.Fixed_Height}
layout.padding = to_ui_layout_side(4)
}
ui_theme_text(); title := ui_text("settings_menu.engine_refresh_hz.title", str_intern("Engine Refresh Hz")); { using title
layout.anchor.ratio.x = 1.0
layout.margins.left = 10
layout.text_alignment = {0, 0.5}
// })
// ui_style( UI_Style {
}
input_box := ui_widget("settings_menu.engine_refresh.input_box", {.Mouse_Clickable, .Focusable, .Click_To_Focus}); { using input_box
layout.flags = {.Fixed_Width}
layout.margins.left = 5
layout.padding.right = 10
layout.size.min.x = 80
if input_box.active do style.bg_color = app_color.input_box_bg_active
else if input_box.hot do style.bg_color = app_color.input_box_bg_hot
else do style.bg_color = app_color.input_box_bg
style.corner_radii[0] = 0.35
}
@static value_str : Array(rune)
if value_str.data == nil {
error : AllocatorError
value_str, error = array_init_reserve(rune, persistent_slab_allocator(), Kilo)
ensure(error != AllocatorError.None, "Failed to allocate array for value_str of input_box")
array_append( & value_str, rune('_'))
}
if input_box.active {
array_append( & value_str, input.keyboard_events.chars_pressed )
array_clear( input.keyboard_events.chars_pressed )
}
else if input_box.was_active {
// })
// res_width_hbox := ui_hbox_begin(.Left_To_Right, "settings_menu.vbox: config.resolution_width: hbox", {})
// ui_parent(res_width_hbox)
spacer := ui_spacer("Settings Menu: Spacer")
spacer.layout.anchor.ratio.y = 1.0
}
else {
array_clear( value_str)
array_append( & value_str, to_runes(str_fmt_alloc("%v", config.engine_refresh_hz)))
}
// input_box
{
ui_parent(input_box)
value_txt := ui_text("settings_menu.engine_refresh.refresh_value", to_str_runes_pair(value_str))
value_txt.layout.text_alignment = vec2(1, 0.5)
}
spacer := ui_spacer("settings_menu.engine_refresh.end_spacer")
spacer.layout.flags = {.Fixed_Width}
spacer.layout.size.min.x = 10
// input_text := ui_text("settings_menu.engine_refresh", str_fmt_alloc(value_str))
}
{
ui_theme_table_row(is_even = true)
hb := ui_hbox(.Left_To_Right, "settings_menu.cam_min_zoom.hb"); { using hb
layout.size.min = {0, 30}
layout.flags = {.Fixed_Height}
}
ui_theme_text(); title := ui_text("settings_menu.cam_min_zoom.title", str_intern("Camera: Min Zoom")); { using title
layout.anchor.ratio.x = 1.0
layout.margins.left = 10
}
}
{
ui_theme_table_row(is_even = false)
hb := ui_hbox(.Left_To_Right, "settings_menu.cam_max_zoom.hb"); { using hb
layout.size.min = {0, 30}
layout.flags = {.Fixed_Height}
}
ui_theme_text(); title := ui_text("settings_menu.cam_max_zoom.title", str_intern("Camera: Max Zoom")); { using title
layout.anchor.ratio.x = 1.0
layout.margins.left = 10
}
}
}
ui_vbox_end(vbox, compute_layout = false )
}
return

@ -159,6 +159,8 @@ AppConfig :: struct {
timing_fps_moving_avg_alpha : f32,
ui_resize_border_width : f32,
color_theme : AppColorTheme,
}
AppWindow :: struct {
@ -257,4 +259,7 @@ get_state :: #force_inline proc "contextless" () -> ^ State {
// return get_state().frametime
// }
app_config :: #force_inline proc "contextless" () -> AppConfig { return get_state().config }
app_color_theme :: #force_inline proc "contextless" () -> AppColorTheme { return get_state().config.color_theme }
#endregion("State")

@ -0,0 +1,473 @@
package sectr
/*
UI Themes: Comprise of UI_Box's layout & style
Provides presets for themes and their interface for manipulating the combo stacks in UI_State in pairs
*/
// TODO(Ed): Eventually this will have a configuration wizard, and we'll save the presets
@(deferred_none = ui_theme_pop)
ui_theme_btn :: proc()
{
@static theme : UI_Theme
@static loaded : b32 = false
if ! loaded
{
app_color := app_color_theme()
layout := UI_Layout {
flags = {},
anchor = range2_zero,
alignment = {0, 0},
text_alignment = {0.5, 0.5},
font_size = 16,
margins = {0, 0, 0, 0},
padding = {0, 0, 0, 0},
border_width = 1,
pos = {0, 0},
size = range2_zero,
}
style := UI_Style {
bg_color = app_color.btn_bg_default,
border_color = app_color.border_default,
corner_radii = {},
blur_size = 0,
font = get_state().default_font,
text_color = app_color.text_default,
cursor = {},
}
layout_combo := to_ui_layout_combo(layout)
style_combo := to_ui_style_combo(style)
Hot: {
using layout_combo.hot
using style_combo.hot
bg_color = app_color.btn_bg_hot
text_color = app_color.text_hot
}
Active: {
using layout_combo.active
using style_combo.active
bg_color = app_color.btn_bg_active
text_color = app_color.text_active
margins = {2, 2, 2, 2}
}
theme = UI_Theme { layout_combo, style_combo }
loaded = true
}
ui_layout_push(theme.layout)
ui_style_push(theme.style)
}
@(deferred_none = ui_theme_pop)
ui_theme_drop_down :: proc()
{
@static theme : UI_Theme
@static loaded : b32 = false
if ! loaded
{
app_color := app_color_theme()
layout := UI_Layout {
flags = {.Fixed_Height},
anchor = range2({0, 0},{}),
alignment = {0, 0},
text_alignment = {0.5, 0.5},
font_size = 14,
margins = {0, 0, 0, 0},
padding = {0, 0, 0, 0},
border_width = 1,
pos = {0, 0},
size = range2({0,20},{})
}
style := UI_Style {
bg_color = app_color.btn_bg_default,
border_color = app_color.border_default,
corner_radii = {},
blur_size = 0,
font = get_state().default_font,
text_color = app_color.text_default,
cursor = {},
}
layout_combo := to_ui_layout_combo(layout)
style_combo := to_ui_style_combo(style)
Hot: {
using layout_combo.hot
using style_combo.hot
bg_color = app_color.btn_bg_hot
text_color = app_color.text_hot
margins = {2, 2, 2, 2}
}
Active: {
using layout_combo.active
using style_combo.active
bg_color = app_color.btn_bg_active
text_color = app_color.text_active
margins = {2, 2, 2, 2}
}
theme = UI_Theme { layout_combo, style_combo }
loaded = true
}
ui_layout_push(theme.layout)
ui_style_push(theme.style)
}
@(deferred_none = ui_theme_pop)
ui_theme_table_row :: proc(is_even : bool)
{
@static theme : UI_Theme
@static loaded : b32 = false
// if ! loaded
{
app_color := app_color_theme()
table_bg : Color
if is_even {
table_bg = app_color.table_even_bg_color
}
else {
table_bg = app_color.table_odd_bg_color
}
layout := UI_Layout {
flags = {},
anchor = range2({},{}),
alignment = {0, 0},
text_alignment = {0.0, 0.0},
font_size = 16,
margins = {0, 0, 0, 0},
padding = {0, 0, 0, 0},
border_width = 0,
pos = {0, 0},
size = range2({},{})
}
style := UI_Style {
bg_color = table_bg,
border_color = Color_Transparent,
corner_radii = {},
blur_size = 0,
font = get_state().default_font,
text_color = app_color_theme().text_default,
cursor = {},
}
layout_combo := to_ui_layout_combo(layout)
style_combo := to_ui_style_combo(style)
Hot: {
using layout_combo.disabled
using style_combo.disabled
}
Active: {
using layout_combo.hot
using style_combo.hot
}
{
using layout_combo.active
using style_combo.active
}
theme = UI_Theme { layout_combo, style_combo }
loaded = true
}
ui_layout_push(theme.layout)
ui_style_push(theme.style)
}
@(deferred_none = ui_theme_pop)
ui_theme_window_bar :: proc()
{
@static theme : UI_Theme
@static loaded : b32 = false
if ! loaded || true
{
app_color := app_color_theme()
layout := UI_Layout {
flags = {.Fixed_Height},
anchor = range2({},{}),
alignment = {0, 0},
text_alignment = {0.0, 0.0},
font_size = 16,
margins = {0, 0, 0, 0},
padding = {0, 0, 0, 0},
border_width = 0.0,
pos = {0, 0},
size = range2({0, 35},{})
}
style := UI_Style {
bg_color = app_color.window_bar_bg,
border_color = Color_Transparent,
corner_radii = {},
blur_size = 0,
font = get_state().default_font,
text_color = app_color.text_default,
cursor = {},
}
layout_combo := to_ui_layout_combo(layout)
style_combo := to_ui_style_combo(style)
Disabled : {
using layout_combo.disabled
using style_combo.disabled
}
Hot: {
using layout_combo.hot
using style_combo.hot
border_color = app_color.window_bar_border
border_width = 1.0
}
Active: {
using layout_combo.active
using style_combo.active
border_color = app_color.window_bar_border
border_width = 2.0
}
theme = UI_Theme { layout_combo, style_combo }
loaded = true
}
ui_layout_push(theme.layout)
ui_style_push(theme.style)
}
@(deferred_none = ui_theme_pop)
ui_theme_window_bar_title :: proc()
{
@static theme : UI_Theme
@static loaded : b32 = false
if ! loaded
{
app_color := app_color_theme()
layout := UI_Layout {
flags = {},
anchor = range2({},{}),
alignment = {0, 0},
text_alignment = {0.0, 0.0},
font_size = 16,
margins = {0, 0, 0, 0},
padding = {0, 0, 0, 0},
border_width = 0,
pos = {0, 0},
size = range2({},{})
}
style := UI_Style {
bg_color = Color_Transparent,
border_color = Color_Transparent,
corner_radii = {},
blur_size = 0,
font = get_state().default_font,
text_color = app_color.text_default,
cursor = {},
}
layout_combo := to_ui_layout_combo(layout)
style_combo := to_ui_style_combo(style)
Disabed: {
using layout_combo.disabled
using style_combo.disabled
}
Hot: {
using layout_combo.hot
using style_combo.hot
}
Active: {
using layout_combo.active
using style_combo.active
}
theme = UI_Theme { layout_combo, style_combo }
loaded = true
}
ui_layout_push(theme.layout)
ui_style_push(theme.style)
}
@(deferred_none = ui_theme_pop)
ui_theme_window_bar_btn :: proc()
{
@static theme : UI_Theme
@static loaded : b32 = false
if ! loaded
{
app_color := app_color_theme()
layout := UI_Layout {
flags = {.Fixed_Width},
anchor = range2({1, 0},{}),
alignment = {0, 0},
text_alignment = {0.5, 0.5},
font_size = 16,
margins = {0, 0, 0, 0},
padding = {0, 0, 0, 0},
border_width = 1,
pos = {0, 0},
size = range2({50,0},{})
}
style := UI_Style {
bg_color = app_color.btn_bg_default,
border_color = app_color.border_default,
corner_radii = {},
blur_size = 0,
font = get_state().default_font,
text_color = app_color.text_default,
cursor = {},
}
layout_combo := to_ui_layout_combo(layout)
style_combo := to_ui_style_combo(style)
Hot: {
using layout_combo.hot
using style_combo.hot
bg_color = app_color.btn_bg_hot
text_color = app_color.text_hot
}
Active: {
using layout_combo.active
using style_combo.active
bg_color = app_color.btn_bg_active
text_color = app_color.text_active
margins = {2, 2, 2, 2}
}
theme = UI_Theme { layout_combo, style_combo }
loaded = true
}
ui_layout_push(theme.layout)
ui_style_push(theme.style)
}
@(deferred_none = ui_theme_pop)
ui_theme_window_panel :: proc()
{
@static theme : UI_Theme
@static loaded : b32 = false
if ! loaded
{
app_color := app_color_theme()
layout := UI_Layout {
flags = {},
anchor = range2({},{}),
alignment = {0, 0},
text_alignment = {0.0, 0.0},
font_size = 16,
margins = {0, 0, 0, 0},
padding = {0, 0, 0, 0},
border_width = 1,
pos = {0, 0},
size = range2({},{})
}
style := UI_Style {
bg_color = app_color.window_panel_bg,
border_color = app_color.window_panel_border,
corner_radii = {},
blur_size = 0,
font = get_state().default_font,
text_color = app_color.text_default,
cursor = {},
}
layout_combo := to_ui_layout_combo(layout)
style_combo := to_ui_style_combo(style)
Disabled: {
using layout_combo.disabled
using style_combo.disabled
}
Hot: {
using layout_combo.hot
using style_combo.hot
}
Active: {
using layout_combo.active
using style_combo.active
}
theme = UI_Theme { layout_combo, style_combo }
loaded = true
}
ui_layout_push(theme.layout)
ui_style_push(theme.style)
}
@(deferred_none = ui_theme_pop)
ui_theme_transparent :: proc()
{
@static theme : UI_Theme
@static loaded : b32 = false
if ! loaded
{
app_color := app_color_theme()
layout := UI_Layout {
flags = {},
anchor = range2({},{}),
alignment = {0, 0},
text_alignment = {0.0, 0.0},
font_size = 16,
margins = {0, 0, 0, 0},
padding = {0, 0, 0, 0},
border_width = 0,
pos = {0, 0},
size = range2({},{})
}
style := UI_Style {
bg_color = Color_Transparent,
border_color = Color_Transparent,
corner_radii = {},
blur_size = 0,
font = get_state().default_font,
text_color = app_color.text_default,
cursor = {},
}
layout_combo := to_ui_layout_combo(layout)
style_combo := to_ui_style_combo(style)
{
using layout_combo.disabled
using style_combo.disabled
}
{
using layout_combo.hot
using style_combo.hot
}
{
using layout_combo.active
using style_combo.active
}
theme = UI_Theme { layout_combo, style_combo }
loaded = true
}
ui_layout_push(theme.layout)
ui_style_push(theme.style)
}
@(deferred_none = ui_theme_pop)
ui_theme_text :: proc()
{
@static theme : UI_Theme
@static loaded : b32 = false
if ! loaded
{
app_color := app_color_theme()
layout := UI_Layout {
flags = {},
anchor = range2({},{}),
alignment = {0, 0},
text_alignment = {0.0, 0.5},
font_size = 14,
margins = {0, 0, 0, 0},
padding = {0, 0, 0, 0},
border_width = 0,
pos = {0, 0},
size = range2({},{})
}
style := UI_Style {
bg_color = Color_Transparent,
border_color = Color_Transparent,
corner_radii = {},
blur_size = 0,
font = get_state().default_font,
text_color = app_color.text_default,
cursor = {},
}
layout_combo := to_ui_layout_combo(layout)
style_combo := to_ui_style_combo(style)
{
using layout_combo.disabled
using style_combo.disabled
}
{
using layout_combo.hot
using style_combo.hot
}
{
using layout_combo.active
using style_combo.active
}
theme = UI_Theme { layout_combo, style_combo }
loaded = true
}
ui_layout_push(theme.layout)
ui_style_push(theme.style)
}

@ -1,114 +0,0 @@
package sectr
/*
UI Themes: Comprise of UI_Box's layout & style
Provides presets for themes and their interface for manipulating the combo stacks in UI_State in pairs
*/
// TODO(Ed): Eventually this will have a configuration wizard, and we'll save the presets
@(deferred_none = ui_theme_pop)
ui_theme_btn_default :: proc()
{
@static theme : UI_Theme
@static loaded : b32 = false
if ! loaded
{
layout := UI_Layout {
flags = {},
anchor = range2({},{}),
alignment = {0, 0},
text_alignment = {0.5, 0.5},
font_size = 16,
margins = {0, 0, 0, 0},
padding = {0, 0, 0, 0},
border_width = 1,
pos = {0, 0},
size = range2({},{})
}
style := UI_Style {
bg_color = Color_ThmDark_Btn_BG_Default,
border_color = Color_ThmDark_Border_Default,
corner_radii = {},
blur_size = 0,
font = get_state().default_font,
text_color = Color_ThmDark_Text_Default,
cursor = {},
}
layout_combo := to_ui_layout_combo(layout)
style_combo := to_ui_style_combo(style)
{
using layout_combo.hot
using style_combo.hot
bg_color = Color_ThmDark_Btn_BG_Hot
text_color = Color_ThmDark_Text_Hot
margins = {2, 2, 2, 2}
}
{
using layout_combo.active
using style_combo.active
bg_color = Color_ThmDark_Btn_BG_Active
text_color = Color_ThmDark_Text_Active
margins = {2, 2, 2, 2}
}
theme = UI_Theme {
layout_combo, style_combo
}
loaded = true
}
ui_layout_push(theme.layout)
ui_style_push(theme.style)
}
@(deferred_none = ui_theme_pop)
ui_theme_transparent :: proc()
{
@static theme : UI_Theme
@static loaded : b32 = false
if ! loaded || true
{
layout := UI_Layout {
flags = {},
anchor = range2({},{}),
alignment = {0, 0},
text_alignment = {0.0, 0.0},
font_size = 16,
margins = {0, 0, 0, 0},
padding = {0, 0, 0, 0},
border_width = 0,
pos = {0, 0},
size = range2({},{})
}
style := UI_Style {
bg_color = Color_Transparent,
border_color = Color_Transparent,
corner_radii = {},
blur_size = 0,
font = get_state().default_font,
text_color = Color_ThmDark_Text_Default,
cursor = {},
}
layout_combo := to_ui_layout_combo(layout)
style_combo := to_ui_style_combo(style)
{
using layout_combo.disabled
using style_combo.disabled
}
{
using layout_combo.hot
using style_combo.hot
}
{
using layout_combo.active
using style_combo.active
}
theme = UI_Theme {
layout_combo, style_combo
}
loaded = true
}
ui_layout_push(theme.layout)
ui_style_push(theme.style)
}