fix: Force devs to choose between ValueClamped and ValueUnclamped

This commit is contained in:
Kaz Wolfe 2025-03-23 18:28:07 -07:00
parent 3074115b34
commit e84654005e
No known key found for this signature in database
GPG key ID: 258813F53A16EBB4
5 changed files with 23 additions and 14 deletions

View file

@ -147,7 +147,7 @@ internal sealed class ComponentDemoWindow : Window
ImGui.Bullet();
ImGui.SetCursorPos(cursor + new Vector2(0, 10));
ImGui.Text($"{easing.GetType().Name} ({easing.Value})");
ImGui.Text($"{easing.GetType().Name} ({easing.ValueClamped})");
ImGuiHelpers.ScaledDummy(5);
}
}

View file

@ -204,7 +204,7 @@ internal class TitleScreenMenuWindow : Window, IDisposable
moveEasing.Update();
var finalPos = (i + 1) * this.shadeTexture.Value.Height * scale;
var pos = moveEasing.Value * finalPos;
var pos = moveEasing.ValueClamped * finalPos;
// FIXME(goat): Sometimes, easings can overshoot and bring things out of alignment.
if (moveEasing.IsDone)
@ -251,7 +251,7 @@ internal class TitleScreenMenuWindow : Window, IDisposable
this.fadeOutEasing.Update();
using (ImRaii.PushStyle(ImGuiStyleVar.Alpha, (float)this.fadeOutEasing.Value))
using (ImRaii.PushStyle(ImGuiStyleVar.Alpha, (float)this.fadeOutEasing.ValueClamped))
{
var i = 0;
foreach (var entry in entries)
@ -317,7 +317,7 @@ internal class TitleScreenMenuWindow : Window, IDisposable
var initialCursor = ImGui.GetCursorPos();
using (ImRaii.PushStyle(ImGuiStyleVar.Alpha, (float)shadeEasing.Value))
using (ImRaii.PushStyle(ImGuiStyleVar.Alpha, (float)shadeEasing.ValueClamped))
{
var texture = this.shadeTexture.Value;
ImGui.Image(texture.ImGuiHandle, new Vector2(texture.Width, texture.Height) * scale);
@ -367,7 +367,7 @@ internal class TitleScreenMenuWindow : Window, IDisposable
if (overrideAlpha)
{
ImGui.PushStyleVar(ImGuiStyleVar.Alpha, isFirst ? 1f : (float)logoEasing.Value);
ImGui.PushStyleVar(ImGuiStyleVar.Alpha, isFirst ? 1f : (float)logoEasing.ValueClamped);
}
else if (isFirst)
{
@ -392,7 +392,7 @@ internal class TitleScreenMenuWindow : Window, IDisposable
if (overrideAlpha)
{
ImGui.PushStyleVar(ImGuiStyleVar.Alpha, showText ? (float)logoEasing.Value : 0f);
ImGui.PushStyleVar(ImGuiStyleVar.Alpha, showText ? (float)logoEasing.ValueClamped : 0f);
}
// Drop shadow