Fix margins on icon-only messages

Messages with an icon and no text (such as in the game start sequence) had an oversized margin due to ImGui adding padding for an empty string.
This commit is contained in:
LillyJadeKatrin 2024-06-13 22:09:15 -04:00
parent 1b00b4e3d8
commit a79f428972
1 changed files with 2 additions and 1 deletions

View File

@ -116,7 +116,8 @@ static float DrawMessage(int index, Message& msg, const ImVec2& position, int ti
}
// Use %s in case message contains %.
ImGui::TextColored(ARGBToImVec4(msg.color), "%s", msg.text.c_str());
if (msg.text.size() > 0)
ImGui::TextColored(ARGBToImVec4(msg.color), "%s", msg.text.c_str());
window_height =
ImGui::GetWindowSize().y + (WINDOW_PADDING * ImGui::GetIO().DisplayFramebufferScale.y);
}