mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2025-10-30 07:11:05 +00:00
Implement vertical marquee fade. (#261)
This commit is contained in:
parent
0426b79094
commit
342d696f99
7 changed files with 40 additions and 17 deletions
|
|
@ -1,15 +1,16 @@
|
|||
#pragma once
|
||||
|
||||
#define IMGUI_SHADER_MODIFIER_NONE 0
|
||||
#define IMGUI_SHADER_MODIFIER_SCANLINE 1
|
||||
#define IMGUI_SHADER_MODIFIER_CHECKERBOARD 2
|
||||
#define IMGUI_SHADER_MODIFIER_SCANLINE_BUTTON 3
|
||||
#define IMGUI_SHADER_MODIFIER_TEXT_SKEW 4
|
||||
#define IMGUI_SHADER_MODIFIER_MARQUEE_FADE 5
|
||||
#define IMGUI_SHADER_MODIFIER_GRAYSCALE 6
|
||||
#define IMGUI_SHADER_MODIFIER_TITLE_BEVEL 7
|
||||
#define IMGUI_SHADER_MODIFIER_CATEGORY_BEVEL 8
|
||||
#define IMGUI_SHADER_MODIFIER_RECTANGLE_BEVEL 9
|
||||
#define IMGUI_SHADER_MODIFIER_NONE 0
|
||||
#define IMGUI_SHADER_MODIFIER_SCANLINE 1
|
||||
#define IMGUI_SHADER_MODIFIER_CHECKERBOARD 2
|
||||
#define IMGUI_SHADER_MODIFIER_SCANLINE_BUTTON 3
|
||||
#define IMGUI_SHADER_MODIFIER_TEXT_SKEW 4
|
||||
#define IMGUI_SHADER_MODIFIER_HORIZONTAL_MARQUEE_FADE 5
|
||||
#define IMGUI_SHADER_MODIFIER_VERTICAL_MARQUEE_FADE 6
|
||||
#define IMGUI_SHADER_MODIFIER_GRAYSCALE 7
|
||||
#define IMGUI_SHADER_MODIFIER_TITLE_BEVEL 8
|
||||
#define IMGUI_SHADER_MODIFIER_CATEGORY_BEVEL 9
|
||||
#define IMGUI_SHADER_MODIFIER_RECTANGLE_BEVEL 10
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ float4 main(in Interpolators interpolators) : SV_Target
|
|||
}
|
||||
}
|
||||
|
||||
if (g_PushConstants.ShaderModifier == IMGUI_SHADER_MODIFIER_MARQUEE_FADE)
|
||||
if (g_PushConstants.ShaderModifier == IMGUI_SHADER_MODIFIER_HORIZONTAL_MARQUEE_FADE)
|
||||
{
|
||||
float minAlpha = saturate((interpolators.Position.x - g_PushConstants.BoundsMin.x) / g_PushConstants.Scale.x);
|
||||
float maxAlpha = saturate((g_PushConstants.BoundsMax.x - interpolators.Position.x) / g_PushConstants.Scale.x);
|
||||
|
|
@ -143,6 +143,14 @@ float4 main(in Interpolators interpolators) : SV_Target
|
|||
color.a *= minAlpha;
|
||||
color.a *= maxAlpha;
|
||||
}
|
||||
else if (g_PushConstants.ShaderModifier == IMGUI_SHADER_MODIFIER_VERTICAL_MARQUEE_FADE)
|
||||
{
|
||||
float minAlpha = saturate((interpolators.Position.y - g_PushConstants.BoundsMin.y) / g_PushConstants.Scale.y);
|
||||
float maxAlpha = saturate((g_PushConstants.BoundsMax.y - interpolators.Position.y) / g_PushConstants.Scale.y);
|
||||
|
||||
color.a *= minAlpha;
|
||||
color.a *= maxAlpha;
|
||||
}
|
||||
else if (any(g_PushConstants.BoundsMin != g_PushConstants.BoundsMax))
|
||||
{
|
||||
float2 factor = saturate((interpolators.Position.xy - g_PushConstants.BoundsMin) / (g_PushConstants.BoundsMax - g_PushConstants.BoundsMin));
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@ void main(in float2 position : POSITION, in float2 uv : TEXCOORD, in float4 colo
|
|||
if (position.y < g_PushConstants.Origin.y)
|
||||
position.x += g_PushConstants.Scale.x;
|
||||
}
|
||||
else if (g_PushConstants.ShaderModifier != IMGUI_SHADER_MODIFIER_MARQUEE_FADE)
|
||||
else if (g_PushConstants.ShaderModifier != IMGUI_SHADER_MODIFIER_HORIZONTAL_MARQUEE_FADE &&
|
||||
g_PushConstants.ShaderModifier != IMGUI_SHADER_MODIFIER_VERTICAL_MARQUEE_FADE)
|
||||
{
|
||||
position.xy = g_PushConstants.Origin + (position.xy - g_PushConstants.Origin) * g_PushConstants.Scale;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ static void DrawAchievement(int rowIndex, float yOffset, Achievement& achievemen
|
|||
ImVec2 marqueeMin = { textMarqueeX, min.y };
|
||||
ImVec2 marqueeMax = { max.x - Scale(10) /* timestamp margin X */, max.y };
|
||||
|
||||
SetMarqueeFade(marqueeMin, marqueeMax, Scale(32));
|
||||
SetHorizontalMarqueeFade(marqueeMin, marqueeMax, Scale(32));
|
||||
|
||||
if (isSelected && textX + textSize.x >= max.x - Scale(10))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ void ResetTextSkew()
|
|||
SetScale({ 1.0f, 1.0f });
|
||||
}
|
||||
|
||||
void SetMarqueeFade(ImVec2 min, ImVec2 max, float fadeScale)
|
||||
void SetHorizontalMarqueeFade(ImVec2 min, ImVec2 max, float fadeScale)
|
||||
{
|
||||
auto callbackData = AddImGuiCallback(ImGuiCallback::SetMarqueeFade);
|
||||
callbackData->setMarqueeFade.boundsMin[0] = min.x;
|
||||
|
|
@ -88,10 +88,22 @@ void SetMarqueeFade(ImVec2 min, ImVec2 max, float fadeScale)
|
|||
callbackData->setMarqueeFade.boundsMax[0] = max.x;
|
||||
callbackData->setMarqueeFade.boundsMax[1] = max.y;
|
||||
|
||||
SetShaderModifier(IMGUI_SHADER_MODIFIER_MARQUEE_FADE);
|
||||
SetShaderModifier(IMGUI_SHADER_MODIFIER_HORIZONTAL_MARQUEE_FADE);
|
||||
SetScale({ fadeScale, 1.0f });
|
||||
}
|
||||
|
||||
void SetVerticalMarqueeFade(ImVec2 min, ImVec2 max, float fadeScale)
|
||||
{
|
||||
auto callbackData = AddImGuiCallback(ImGuiCallback::SetMarqueeFade);
|
||||
callbackData->setMarqueeFade.boundsMin[0] = min.x;
|
||||
callbackData->setMarqueeFade.boundsMin[1] = min.y;
|
||||
callbackData->setMarqueeFade.boundsMax[0] = max.x;
|
||||
callbackData->setMarqueeFade.boundsMax[1] = max.y;
|
||||
|
||||
SetShaderModifier(IMGUI_SHADER_MODIFIER_VERTICAL_MARQUEE_FADE);
|
||||
SetScale({ 1.0f, fadeScale });
|
||||
}
|
||||
|
||||
void ResetMarqueeFade()
|
||||
{
|
||||
ResetGradient();
|
||||
|
|
|
|||
|
|
@ -42,7 +42,8 @@ void SetOrigin(ImVec2 origin);
|
|||
void SetScale(ImVec2 scale);
|
||||
void SetTextSkew(float yCenter, float skewScale);
|
||||
void ResetTextSkew();
|
||||
void SetMarqueeFade(ImVec2 min, ImVec2 max, float fadeScale);
|
||||
void SetHorizontalMarqueeFade(ImVec2 min, ImVec2 max, float fadeScale);
|
||||
void SetVerticalMarqueeFade(ImVec2 min, ImVec2 max, float fadeScale);
|
||||
void ResetMarqueeFade();
|
||||
void SetOutline(float outline);
|
||||
void ResetOutline();
|
||||
|
|
|
|||
|
|
@ -797,7 +797,7 @@ static void DrawDescriptionContainer()
|
|||
ImVec2 textMin = { g_aspectRatioOffsetX + Scale(CONTAINER_X), textPos.y };
|
||||
ImVec2 textMax = { g_aspectRatioOffsetX + Scale(CONTAINER_X) + Scale(CONTAINER_WIDTH), g_aspectRatioOffsetY + Scale(CONTAINER_Y) + Scale(CONTAINER_HEIGHT) };
|
||||
|
||||
SetMarqueeFade(textMin, textMax, Scale(32));
|
||||
SetHorizontalMarqueeFade(textMin, textMax, Scale(32));
|
||||
DrawTextWithMarquee(g_seuratFont, fontSize, textPos, textMin, textMax, colWhite, g_creditsStr.c_str(), g_installerEndTime, 0.9, Scale(200));
|
||||
ResetMarqueeFade();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue