h -= 4;
w = 100;
+ theme := Button_Theme.{};
for^ type_info.enum_values(Tabs) {
// Don't draw the "None" item;
if it.value == 0 do continue;
- theme := Button_Theme.{};
theme.active = active_tab == ~~it.value;
if draw_button(.{x, y, w, h}, it.name, ^theme, increment=~~it.value) {
clicked_tab = ~~it.value;
info := cast(^type_info.Type_Info_Struct) type_info.get_type_info(type);
y += 40.0f;
- theme := Button_Theme.{};
- theme.active = active_index == i;
+ theme := Button_Theme.{active = active_index == i};
if draw_button(.{x, y - 18, w, 36.0f}, info.name, ^theme, increment=i) {
active_index = i;
}
test << #char "t";
}
- theme := Textbox_Theme.{};
- draw_textbox(.{x, y + 72.0f, w, 36.0f}, ^test, theme=^theme);
+ draw_textbox(.{x, y + 72.0f, w, 36.0f}, ^test);
}
#local render_entity_fields :: (entity: ^Entity, x, y, w, h: f32) {
active := false;
}
-default_button_theme := Button_Theme.{};
+#local default_button_theme := Button_Theme.{};
-draw_button :: (use r: Rect, text: str, theme: ^Button_Theme, site := #callsite, increment := 0) -> bool {
- // HMMM.... this should be gotten rid of as quick as possible.
- __ASDF := Button_Theme.{};
- if theme == null {
- theme = ^__ASDF;
- }
+draw_button :: (use r: Rect, text: str, theme := ^default_button_theme, site := #callsite, increment := 0) -> bool {
result := false;
hash := get_site_hash(site, increment);
placeholder_text_color := Color.{ 0.5, 0.5, 0.5 };
}
-default_textbox_theme := Textbox_Theme.{};
-
#local {
+ default_textbox_theme := Textbox_Theme.{};
+
Textbox_Editing_State :: struct {
hash: UI_Id = 0;
textbox_editing_state := Textbox_Editing_State.{};
}
-draw_textbox :: (use r: Rect, text_buffer: ^[..] u8, placeholder := null_str, theme: ^Textbox_Theme = null, site := #callsite, increment := 0) -> bool {
+draw_textbox :: (use r: Rect, text_buffer: ^[..] u8, placeholder := null_str, theme := ^default_textbox_theme, site := #callsite, increment := 0) -> bool {
result := false;
hash := get_site_hash(site, increment);
textbox_editing_state.cursor_position = math.clamp(textbox_editing_state.cursor_position, 0, text_buffer.count);
textbox_editing_state.cursor_animation = 1.0f;
+
+ text = str.{text_buffer.data, text_buffer.count};
}
}