FullscreenUI: Warning fixes

This commit is contained in:
Stenzek 2025-06-15 13:31:43 +10:00
parent 0c8cf0a4d7
commit 35a8bfa469
No known key found for this signature in database
2 changed files with 6 additions and 9 deletions

View File

@ -8325,7 +8325,6 @@ void FullscreenUI::DrawGameGrid(const ImVec2& heading_size)
const ImRect title_bb(ImVec2(bb.Min.x, bb.Min.y + image_height + title_spacing), bb.Max); const ImRect title_bb(ImVec2(bb.Min.x, bb.Min.y + image_height + title_spacing), bb.Max);
const char* remaining_text; const char* remaining_text;
const ImVec2 full_text_size =
UIStyle.Font->CalcTextSizeA(UIStyle.MediumFontSize, UIStyle.NormalFontWeight, bb.GetWidth(), 0.0f, UIStyle.Font->CalcTextSizeA(UIStyle.MediumFontSize, UIStyle.NormalFontWeight, bb.GetWidth(), 0.0f,
IMSTR_START_END(entry->title), &remaining_text); IMSTR_START_END(entry->title), &remaining_text);
const u32 unclipped_size = static_cast<u32>(remaining_text - entry->title.data()); const u32 unclipped_size = static_cast<u32>(remaining_text - entry->title.data());

View File

@ -1579,7 +1579,6 @@ void ImGuiFullscreen::TextAlignedMultiLine(float align_x, const char* text, cons
{ {
// Find the end of the current wrapped line // Find the end of the current wrapped line
const char* line_end = text_remaining; const char* line_end = text_remaining;
float line_width = 0.0f;
// Process text word by word to find natural line breaks // Process text word by word to find natural line breaks
while (line_end < text_end) while (line_end < text_end)
@ -1603,14 +1602,13 @@ void ImGuiFullscreen::TextAlignedMultiLine(float align_x, const char* text, cons
word_end++; word_end++;
// Calculate width if we add this word // Calculate width if we add this word
ImVec2 word_size = ImGui::CalcTextSize(text_remaining, word_end, false, -1.0f); const ImVec2 word_size = ImGui::CalcTextSize(text_remaining, word_end, false, -1.0f);
// If adding this word would exceed wrap width, break here // If adding this word would exceed wrap width, break here
if (word_size.x > wrap_width && line_end > text_remaining) if (word_size.x > wrap_width && line_end > text_remaining)
break; break;
line_end = word_end; line_end = word_end;
line_width = word_size.x;
} }
// If we didn't advance at all, force at least one character to prevent infinite loop // If we didn't advance at all, force at least one character to prevent infinite loop
@ -1618,7 +1616,7 @@ void ImGuiFullscreen::TextAlignedMultiLine(float align_x, const char* text, cons
line_end++; line_end++;
// Calculate actual line size for the determined line segment // Calculate actual line size for the determined line segment
ImVec2 line_size = ImGui::CalcTextSize(text_remaining, line_end, false, -1.0f); const ImVec2 line_size = ImGui::CalcTextSize(text_remaining, line_end, false, -1.0f);
// Calculate aligned position for this line // Calculate aligned position for this line
ImVec2 line_pos = pos; ImVec2 line_pos = pos;
@ -1645,8 +1643,8 @@ void ImGuiFullscreen::TextAlignedMultiLine(float align_x, const char* text, cons
} }
// Update cursor position to account for the rendered text // Update cursor position to account for the rendered text
ImVec2 text_size = ImVec2(wrap_width, pos.y - text_pos.y); const ImVec2 text_size = ImVec2(wrap_width, pos.y - text_pos.y);
ImRect bb(text_pos, text_pos + text_size); const ImRect bb(text_pos, text_pos + text_size);
ImGui::ItemSize(text_size); ImGui::ItemSize(text_size);
ImGui::ItemAdd(bb, 0); ImGui::ItemAdd(bb, 0);
} }