fix: only render on changes
This commit is contained in:
+5
-5
@@ -71,7 +71,7 @@ m3_switch :: proc(on: ^bool, id: engine.Id) -> bool {
|
||||
|
||||
d := new(Switch_Draw, context.temp_allocator)
|
||||
d.t = engine.ui_anim_f32(id, on^ ? 1 : 0)
|
||||
engine.ui_box_equip_custom_draw(box, switch_draw, d)
|
||||
engine.ui_box_equip_custom_draw(box, switch_draw, d, transmute(u32)d.t)
|
||||
return clicked
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ m3_checkbox :: proc(checked: ^bool, id: engine.Id) -> bool {
|
||||
|
||||
d := new(Check_Draw, context.temp_allocator)
|
||||
d.t = engine.ui_anim_f32(id, checked^ ? 1 : 0)
|
||||
engine.ui_box_equip_custom_draw(box, checkbox_draw, d)
|
||||
engine.ui_box_equip_custom_draw(box, checkbox_draw, d, transmute(u32)d.t)
|
||||
|
||||
if checked^ {
|
||||
engine.push_parent(box)
|
||||
@@ -182,7 +182,7 @@ m3_radio :: proc(selected: bool, id: engine.Id) -> bool {
|
||||
|
||||
d := new(Radio_Draw, context.temp_allocator)
|
||||
d.t = engine.ui_anim_f32(id, selected ? 1 : 0)
|
||||
engine.ui_box_equip_custom_draw(box, radio_draw, d)
|
||||
engine.ui_box_equip_custom_draw(box, radio_draw, d, transmute(u32)d.t)
|
||||
return engine.ui_clicked(sig)
|
||||
}
|
||||
|
||||
@@ -246,7 +246,7 @@ m3_slider :: proc(value: ^f32, id: engine.Id) -> bool {
|
||||
|
||||
d := new(Slider_Draw, context.temp_allocator)
|
||||
d.t = clamp(value^, 0, 1)
|
||||
engine.ui_box_equip_custom_draw(box, slider_draw, d)
|
||||
engine.ui_box_equip_custom_draw(box, slider_draw, d, transmute(u32)d.t)
|
||||
return changed
|
||||
}
|
||||
|
||||
@@ -283,7 +283,7 @@ m3_progress_linear :: proc(value: f32, id: engine.Id) {
|
||||
|
||||
d := new(Progress_Draw, context.temp_allocator)
|
||||
d.t = value
|
||||
engine.ui_box_equip_custom_draw(box, progress_draw, d)
|
||||
engine.ui_box_equip_custom_draw(box, progress_draw, d, transmute(u32)d.t)
|
||||
}
|
||||
|
||||
m3_lerp_color :: proc(a, b: engine.Color, t: f32) -> engine.Color {
|
||||
|
||||
Reference in New Issue
Block a user