push ui blend rates to style stack
This commit is contained in:
parent
dc575b9831
commit
08dec960e6
@ -632,8 +632,14 @@ V_WidgetTheme V_GetWidgetTheme(void)
|
||||
theme.window_padding = 1;
|
||||
|
||||
//- Colors
|
||||
theme.col.window_bg = Rgb32(0xff1a1d1e);
|
||||
theme.col.window_bd = Rgb32(0xff343a3b);
|
||||
theme.col.window_fg = Rgb32(0xff1a1d1e);
|
||||
theme.col.window_bg = theme.col.window_fg;
|
||||
|
||||
// theme.col.window_bg.r = theme.col.window_fg.r * 0.6375;
|
||||
// theme.col.window_bg.g = theme.col.window_fg.g * 0.6375;
|
||||
// theme.col.window_bg.b = theme.col.window_fg.b * 0.6375;
|
||||
// theme.col.window_bg.a = 1;
|
||||
|
||||
theme.col.panel_bg = theme.col.window_bg;
|
||||
theme.col.panel_bd = theme.col.window_bd;
|
||||
@ -4508,7 +4514,7 @@ void V_TickForever(WaveLaneCtx *lane)
|
||||
// UI_PushDF(TextColor, theme.col.hint)
|
||||
UI_BuildBox();
|
||||
|
||||
UI_PushDF(Text, Lit("(Lane 0)"))
|
||||
UI_PushDF(Text, Lit("Lane 0"))
|
||||
UI_PushDF(TextColor, theme.col.hint)
|
||||
UI_BuildBox();
|
||||
}
|
||||
|
||||
@ -59,6 +59,7 @@ Struct(V_WidgetTheme)
|
||||
struct
|
||||
{
|
||||
Vec4 window_bg;
|
||||
Vec4 window_fg;
|
||||
Vec4 window_bd;
|
||||
Vec4 divider;
|
||||
|
||||
|
||||
@ -317,6 +317,11 @@ void UI_PushDefaults(void)
|
||||
case UI_StyleKind_DebugColor: { desc.style.DebugColor = Rgba(1, 0, 1, 0.5); } break;
|
||||
case UI_StyleKind_InvisibleDebugColor: { desc.style.InvisibleDebugColor = Rgba(0, 1, 1, 0.25); } break;
|
||||
case UI_StyleKind_BackgroundTextureSliceUv: { desc.style.BackgroundTextureSliceUv = RNG2(VEC2(0, 0), VEC2(1, 1)); } break;
|
||||
case UI_StyleKind_ActiveRate: { desc.style.ActiveRate = 15; } break;
|
||||
case UI_StyleKind_HotRate: { desc.style.HotRate = 15; } break;
|
||||
case UI_StyleKind_HoveredRate: { desc.style.HoveredRate = 15; } break;
|
||||
case UI_StyleKind_ExistsRate: { desc.style.ExistsRate = 30; } break;
|
||||
case UI_StyleKind_MiscRate: { desc.style.MiscRate = Inf; } break;
|
||||
};
|
||||
UI_PushStyle(desc);
|
||||
}
|
||||
@ -494,6 +499,11 @@ UI_Key UI_BuildBoxEx(UI_Key semantic_key)
|
||||
n->cmd.box.zag_amplitude = UI_Top(ZagAmplitude);
|
||||
n->cmd.box.zag_thickness = UI_Top(ZagThickness);
|
||||
n->cmd.box.zag_roundness = UI_Top(ZagRoundness);
|
||||
n->cmd.box.active_rate = UI_Top(ActiveRate);
|
||||
n->cmd.box.hot_rate = UI_Top(HotRate);
|
||||
n->cmd.box.hovered_rate = UI_Top(HoveredRate);
|
||||
n->cmd.box.exists_rate = UI_Top(ExistsRate);
|
||||
n->cmd.box.misc_rate = UI_Top(MiscRate);
|
||||
}
|
||||
++frame->cmds_count;
|
||||
SllQueuePush(frame->first_cmd_node, frame->last_cmd_node, n);
|
||||
@ -848,21 +858,30 @@ UI_Frame *UI_BeginFrame(UI_FrameFlag frame_flags)
|
||||
f32 target_hot = feedback->hot_absolute ? Inf : lower_target;
|
||||
f32 target_hovered = feedback->hovered_absolute ? Inf : lower_target;
|
||||
f32 target_exists = feedback->exists_absolute ? upper_target : lower_target;
|
||||
f32 target_misc = box->desc.misc;
|
||||
f64 target_misc = box->desc.misc;
|
||||
|
||||
feedback->active_smooth = SaturateF32(LerpF32(feedback->active_smooth, target_active, box->desc.active_rate * frame->dt));
|
||||
feedback->hot_smooth = SaturateF32(LerpF32(feedback->hot_smooth, target_hot, box->desc.hot_rate * frame->dt));
|
||||
feedback->hovered_smooth = SaturateF32(LerpF32(feedback->hovered_smooth, target_hovered, box->desc.hovered_rate * frame->dt));
|
||||
feedback->exists_smooth = SaturateF32(LerpF32(feedback->exists_smooth, target_exists, box->desc.exists_rate * frame->dt));
|
||||
feedback->misc_smooth = SaturateF64(LerpF64(feedback->misc_smooth, target_misc, box->desc.misc_rate * frame->dt));
|
||||
|
||||
|
||||
// f32 active_blend_rate = (15 * frame->dt);
|
||||
// f32 hot_blend_rate = (15 * frame->dt);
|
||||
// f32 hovered_blend_rate = (15 * frame->dt);
|
||||
// f32 exists_blend_rate = (30 * frame->dt);
|
||||
// // f64 misc_blend_rate = (30 * frame->dt);
|
||||
// f64 misc_blend_rate = 1;
|
||||
|
||||
// feedback->active_smooth = SaturateF32(LerpF32(feedback->active_smooth, target_active, active_blend_rate));
|
||||
// feedback->hot_smooth = SaturateF32(LerpF32(feedback->hot_smooth, target_hot, hot_blend_rate));
|
||||
// feedback->hovered_smooth = SaturateF32(LerpF32(feedback->hovered_smooth, target_hovered, hovered_blend_rate));
|
||||
// feedback->exists_smooth = SaturateF32(LerpF32(feedback->exists_smooth, target_exists, exists_blend_rate));
|
||||
// feedback->misc_smooth = SaturateF32(LerpF32(feedback->misc_smooth, target_misc, misc_blend_rate));
|
||||
|
||||
|
||||
// TODO: Configurable per-box blend rates
|
||||
f32 active_blend_rate = (15 * frame->dt);
|
||||
f32 hot_blend_rate = (15 * frame->dt);
|
||||
f32 hovered_blend_rate = (15 * frame->dt);
|
||||
f32 exists_blend_rate = (30 * frame->dt);
|
||||
// f64 misc_blend_rate = (30 * frame->dt);
|
||||
f64 misc_blend_rate = 1;
|
||||
|
||||
feedback->active_smooth = SaturateF32(LerpF32(feedback->active_smooth, target_active, active_blend_rate));
|
||||
feedback->hot_smooth = SaturateF32(LerpF32(feedback->hot_smooth, target_hot, hot_blend_rate));
|
||||
feedback->hovered_smooth = SaturateF32(LerpF32(feedback->hovered_smooth, target_hovered, hovered_blend_rate));
|
||||
feedback->exists_smooth = SaturateF32(LerpF32(feedback->exists_smooth, target_exists, exists_blend_rate));
|
||||
feedback->misc_smooth = SaturateF32(LerpF32(feedback->misc_smooth, target_misc, misc_blend_rate));
|
||||
|
||||
feedback->screen_rect = box->screen_rect;
|
||||
feedback->screen_anchor = box->screen_anchor;
|
||||
|
||||
@ -160,6 +160,11 @@ Enum(UI_DebugBreakFlag)
|
||||
X(ZagAmplitude, f32) \
|
||||
X(ZagThickness, f32) \
|
||||
X(ZagRoundness, f32) \
|
||||
X(ActiveRate, f32) \
|
||||
X(HotRate, f32) \
|
||||
X(HoveredRate, f32) \
|
||||
X(ExistsRate, f32) \
|
||||
X(MiscRate, f64) \
|
||||
/* --------------------------------------------- */ \
|
||||
/* --------------- Virtual styles -------------- */ \
|
||||
/* --------------------------------------------- */ \
|
||||
@ -304,6 +309,11 @@ Struct(UI_BoxDesc)
|
||||
f32 zag_amplitude;
|
||||
f32 zag_thickness;
|
||||
f32 zag_roundness;
|
||||
f32 active_rate;
|
||||
f32 hot_rate;
|
||||
f32 hovered_rate;
|
||||
f32 exists_rate;
|
||||
f32 misc_rate;
|
||||
};
|
||||
|
||||
Struct(UI_Cmd)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user