mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2025-10-30 07:11:05 +00:00
Fix faulty ImGui clip rect usage. (#211)
This commit is contained in:
parent
a5db997e5d
commit
a9677084ea
4 changed files with 56 additions and 44 deletions
|
|
@ -2098,8 +2098,9 @@ static void DrawImGui()
|
|||
ButtonGuide::Draw();
|
||||
Fader::Draw();
|
||||
|
||||
DrawProfiler();
|
||||
assert(ImGui::GetForegroundDrawList()->_ClipRectStack.Size == 1 && "Some clip rects were not removed from the stack!");
|
||||
|
||||
DrawProfiler();
|
||||
ImGui::Render();
|
||||
|
||||
auto drawData = ImGui::GetDrawData();
|
||||
|
|
|
|||
|
|
@ -580,11 +580,13 @@ static void DrawContentContainer()
|
|||
|
||||
if (motion < 1.0f)
|
||||
{
|
||||
drawList->PopClipRect();
|
||||
return;
|
||||
}
|
||||
else if (g_isClosing)
|
||||
{
|
||||
AchievementMenu::s_isVisible = false;
|
||||
drawList->PopClipRect();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -67,9 +67,13 @@ static bool DrawContainer(ImVec2 min, ImVec2 max, float cornerRadius = 25)
|
|||
|
||||
DrawPauseContainer(g_upWindow.get(), min, max, alpha);
|
||||
|
||||
drawList->PushClipRect(min, max);
|
||||
if (containerMotion >= 1.0f)
|
||||
{
|
||||
drawList->PushClipRect(min, max);
|
||||
return true;
|
||||
}
|
||||
|
||||
return containerMotion >= 1.0f;
|
||||
return false;
|
||||
}
|
||||
|
||||
void AchievementOverlay::Init()
|
||||
|
|
@ -117,49 +121,50 @@ void AchievementOverlay::Draw()
|
|||
|
||||
if (DrawContainer(min, max))
|
||||
{
|
||||
if (g_isClosing)
|
||||
if (!g_isClosing)
|
||||
{
|
||||
// Draw achievement icon.
|
||||
drawList->AddImage
|
||||
(
|
||||
g_xdbfTextureCache[g_achievement.ID], // user_texture_id
|
||||
{ /* X */ min.x + imageMarginX, /* Y */ min.y + imageMarginY }, // p_min
|
||||
{ /* X */ min.x + imageMarginX + imageSize, /* Y */ min.y + imageMarginY + imageSize }, // p_max
|
||||
{ 0, 0 }, // uv_min
|
||||
{ 1, 1 }, // uv_max
|
||||
IM_COL32(255, 255, 255, 255) // col
|
||||
);
|
||||
|
||||
// Draw header text.
|
||||
DrawTextWithShadow
|
||||
(
|
||||
g_fntSeurat, // font
|
||||
fontSize, // fontSize
|
||||
{ /* X */ min.x + textMarginX + (maxSize - headerSize.x) / 2, /* Y */ min.y + textMarginY }, // pos
|
||||
IM_COL32(252, 243, 5, 255), // colour
|
||||
strAchievementUnlocked, // text
|
||||
2, // offset
|
||||
1.0f, // radius
|
||||
IM_COL32(0, 0, 0, 255) // shadowColour
|
||||
);
|
||||
|
||||
// Draw achievement name.
|
||||
DrawTextWithShadow
|
||||
(
|
||||
g_fntSeurat, // font
|
||||
fontSize, // fontSize
|
||||
{ /* X */ min.x + textMarginX + (maxSize - bodySize.x) / 2, /* Y */ min.y + textMarginY + bodySize.y + Scale(6) }, // pos
|
||||
IM_COL32(255, 255, 255, 255), // colour
|
||||
strAchievementName, // text
|
||||
2, // offset
|
||||
1.0f, // radius
|
||||
IM_COL32(0, 0, 0, 255) // shadowColour
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
s_isVisible = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// Draw achievement icon.
|
||||
drawList->AddImage
|
||||
(
|
||||
g_xdbfTextureCache[g_achievement.ID], // user_texture_id
|
||||
{ /* X */ min.x + imageMarginX, /* Y */ min.y + imageMarginY }, // p_min
|
||||
{ /* X */ min.x + imageMarginX + imageSize, /* Y */ min.y + imageMarginY + imageSize }, // p_max
|
||||
{ 0, 0 }, // uv_min
|
||||
{ 1, 1 }, // uv_max
|
||||
IM_COL32(255, 255, 255, 255) // col
|
||||
);
|
||||
|
||||
// Draw header text.
|
||||
DrawTextWithShadow
|
||||
(
|
||||
g_fntSeurat, // font
|
||||
fontSize, // fontSize
|
||||
{ /* X */ min.x + textMarginX + (maxSize - headerSize.x) / 2, /* Y */ min.y + textMarginY }, // pos
|
||||
IM_COL32(252, 243, 5, 255), // colour
|
||||
strAchievementUnlocked, // text
|
||||
2, // offset
|
||||
1.0f, // radius
|
||||
IM_COL32(0, 0, 0, 255) // shadowColour
|
||||
);
|
||||
|
||||
// Draw achievement name.
|
||||
DrawTextWithShadow
|
||||
(
|
||||
g_fntSeurat, // font
|
||||
fontSize, // fontSize
|
||||
{ /* X */ min.x + textMarginX + (maxSize - bodySize.x) / 2, /* Y */ min.y + textMarginY + bodySize.y + Scale(6) }, // pos
|
||||
IM_COL32(255, 255, 255, 255), // colour
|
||||
strAchievementName, // text
|
||||
2, // offset
|
||||
1.0f, // radius
|
||||
IM_COL32(0, 0, 0, 255) // shadowColour
|
||||
);
|
||||
|
||||
// Pop clip rect from DrawContainer.
|
||||
drawList->PopClipRect();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -192,9 +192,13 @@ bool DrawContainer(float appearTime, ImVec2 centre, ImVec2 max, bool isForegroun
|
|||
|
||||
DrawPauseContainer(g_upWindow.get(), _min, _max, alpha);
|
||||
|
||||
drawList->PushClipRect(_min, _max);
|
||||
if (containerMotion >= 1.0f && !g_isClosing)
|
||||
{
|
||||
drawList->PushClipRect(_min, _max);
|
||||
return true;
|
||||
}
|
||||
|
||||
return containerMotion >= 1.0f && !g_isClosing;
|
||||
return false;
|
||||
}
|
||||
|
||||
void DrawButton(int rowIndex, float yOffset, float width, float height, std::string& text)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue