16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-17 23:39:18 +02:00

Add scenery name for eligible trivia in scenery loading uilayer

This commit is contained in:
2026-04-14 20:39:43 +02:00
parent bcf3d2fdd8
commit bc8c604e25
2 changed files with 16 additions and 0 deletions

View File

@@ -91,6 +91,8 @@ std::vector<std::string> scenarioloader_ui::get_random_trivia()
int i = RandomInt(0, static_cast<int>(triviaData.size()) - 1);
std::string triviaStr = triviaData[i]["text"];
std::string background = triviaData[i]["background"];
if (triviaData[i].contains("scenery"))
sceneryName = triviaData[i]["scenery"];
// divide trivia into multiple lines - UTF-8 safe implementation
// Different languages need different character limits due to character width differences
@@ -276,6 +278,15 @@ void scenarioloader_ui::render_()
}
}
// Scenery name
// Draw only if defined
if (!sceneryName.empty())
{
ImVec2 text_size = ImGui::CalcTextSize(sceneryName.c_str());
ImVec2 text_pos = ImVec2(screen_size.x - 16 - text_size.x, 16);
draw_list->AddText(text_pos, IM_COL32_WHITE, sceneryName.c_str());
}
// Progress bar at the bottom of the screen
const auto p1 = ImVec2(0, Global.window_size.y - 2);
const auto p2 = ImVec2(Global.window_size.x * m_progress, Global.window_size.y);

View File

@@ -30,4 +30,9 @@ private:
std::vector<std::string> get_random_trivia();
void generate_gradient_tex();
void load_wheel_frames();
/// <summary>
/// Scenery name for eligable trivias
/// </summary>
std::string sceneryName;
};