Button_Theme :: struct {
use text_theme := Text_Theme.{};
+ use animation_theme := Animation_Theme.{};
background_color := gfx.Color4.{ 0.1, 0.1, 0.1 };
hover_color := gfx.Color4.{ 0.3, 0.3, 0.3 };
}
if is_hot_item(hash) {
- move_towards(^animation_state.hover_time, 1.0f, 0.1f); @ThemeConfiguration
+ move_towards(^animation_state.hover_time, 1.0f, theme.hover_speed);
} else {
- move_towards(^animation_state.hover_time, 0.0f, 0.1f); @ThemeConfiguration
+ move_towards(^animation_state.hover_time, 0.0f, theme.hover_speed);
}
border_width := theme.border_width;
y0 + ~~ font.common.baseline * theme.font_size + (height - text_height) / 2,
theme.font_size, theme.text_color);
- move_towards(^animation_state.click_time, 0.0f, 0.08f); @ThemeConfiguration
+ move_towards(^animation_state.click_time, 0.0f, theme.click_decay_speed);
if animation_state.click_time > 0 || animation_state.hover_time > 0 {
map.put(^animation_states, hash, animation_state);
Checkbox_Theme :: struct {
use text_theme := Text_Theme.{};
+ use animation_theme := Animation_Theme.{};
box_color := gfx.Color4.{ 0.2, 0.2, 0.2 };
box_border_width := 4.0f; @InPixels
}
if is_hot_item(hash) {
- move_towards(^animation_state.hover_time, 1.0f, 0.1f); @ThemeConfiguration
+ move_towards(^animation_state.hover_time, 1.0f, theme.hover_speed);
} else {
- move_towards(^animation_state.hover_time, 0.0f, 0.1f); @ThemeConfiguration
+ move_towards(^animation_state.hover_time, 0.0f, theme.hover_speed);
}
y0 + ~~ font.common.baseline * theme.font_size + (height - text_height) / 2,
theme.font_size, theme.text_color);
- move_towards(^animation_state.click_time, 0.0f, 0.08f); @ThemeConfiguration
+ move_towards(^animation_state.click_time, 0.0f, theme.click_decay_speed);
if animation_state.click_time > 0 || animation_state.hover_time > 0 {
map.put(^animation_states, hash, animation_state);
Radio_Theme :: struct {
use text_theme := Text_Theme.{};
+ use animation_theme := Animation_Theme.{};
radio_color := gfx.Color4.{ 0.2, 0.2, 0.2 };
radio_border_radius := 4.0f; @InPixels
}
if is_hot_item(hash) {
- move_towards(^animation_state.hover_time, 1.0f, 0.1f); @ThemeConfiguration
+ move_towards(^animation_state.hover_time, 1.0f, theme.hover_speed);
} else {
- move_towards(^animation_state.hover_time, 0.0f, 0.1f); @ThemeConfiguration
+ move_towards(^animation_state.hover_time, 0.0f, theme.hover_speed);
}
radius := theme.radio_radius;
y0 + ~~ font.common.baseline * theme.font_size + (height - text_height) / 2,
theme.font_size, theme.text_color);
- move_towards(^animation_state.click_time, 0.0f, 0.08f); @ThemeConfiguration
+ move_towards(^animation_state.click_time, 0.0f, theme.click_decay_speed);
if animation_state.click_time > 0 || animation_state.hover_time > 0 {
map.put(^animation_states, hash, animation_state);
Slider_Theme :: struct {
use text_theme := Text_Theme.{};
+ use animation_theme := Animation_Theme.{};
box_color := gfx.Color4.{ 0.1, 0.1, 0.1 };
box_border_color := gfx.Color4.{ 0.2, 0.2, 0.2 };
}
if is_hot_item(hash) {
- move_towards(^animation_state.hover_time, 1.0f, 0.1f); @ThemeConfiguration
+ move_towards(^animation_state.hover_time, 1.0f, theme.hover_speed);
} else {
- move_towards(^animation_state.hover_time, 0.0f, 0.1f); @ThemeConfiguration
+ move_towards(^animation_state.hover_time, 0.0f, theme.hover_speed);
}
box_border_width := theme.box_border_width;
// text_color = .{1, 1, 1}
};
+ use animation_theme := Animation_Theme.{};
+
// background_color := gfx.Color4.{ 0.1, 0.1, 0.1 };
// hover_color := gfx.Color4.{ 0.3, 0.3, 0.3 };
// click_color := gfx.Color4.{ 0.5, 0.5, 0.7 };
}
if is_hot_item(hash) {
- move_towards(^animation_state.hover_time, 1.0f, 0.1f); @ThemeConfiguration
+ move_towards(^animation_state.hover_time, 1.0f, theme.hover_speed);
} else {
- move_towards(^animation_state.hover_time, 0.0f, 0.1f); @ThemeConfiguration
+ move_towards(^animation_state.hover_time, 0.0f, theme.hover_speed);
}
gfx.set_texture();
color=cursor_color);
}
- move_towards(^animation_state.click_time, 0.0f, 0.08f); @ThemeConfiguration
+ move_towards(^animation_state.click_time, 0.0f, theme.click_decay_speed);
if animation_state.click_time > 0 || animation_state.hover_time > 0 {
map.put(^animation_states, hash, animation_state);
}
default_text_theme := Text_Theme.{};
-
+Animation_Theme :: struct {
+ hover_speed := 0.1f;
+ click_decay_speed := 0.08f;
+}
+
// Animation states are stored globally as there is not much to the state of a button.
b = c1.b * (1 - t) + c2.b * t,
a = c1.a * (1 - t) + c2.a * t, @Cleanup // should this be interpolating alphas?
};
-}
\ No newline at end of file
+}
}
}
- if (is_lval((AstNode *) field->expr)) {
+ if (is_lval((AstNode *) field->expr) || type_is_pointer(field->expr->type)) {
u64 offset = 0;
emit_field_access_location(mod, &code, field, &offset);
emit_load_instruction(mod, &code, field->type, offset);
bh_arr_new(alloc, module.data, 4);
bh_arr_new(alloc, module.elems, 4);
- // NOTE: 16 is probably needlessly large
bh_arr_new(global_heap_allocator, module.structured_jump_target, 16);
bh_arr_set_length(module.structured_jump_target, 0);
case Entity_Type_Global: emit_global(module, ent->global); break;
// Cleanup: Maybe these should be printed elsewhere?
+ // Also, they should be sorted? Or have that ability?
case Entity_Type_Note: {
if (!context.options->print_notes) break;
println(get_foo().age);
println((Foo.{ 0, 0, "Worked!", 0 }).name);
-}
\ No newline at end of file
+}