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:
@@ -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
|
||||
@@ -275,6 +277,15 @@ void scenarioloader_ui::render_()
|
||||
draw_list->AddText(text_pos, IM_COL32_WHITE, line.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user