mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 16:19:19 +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);
|
int i = RandomInt(0, static_cast<int>(triviaData.size()) - 1);
|
||||||
std::string triviaStr = triviaData[i]["text"];
|
std::string triviaStr = triviaData[i]["text"];
|
||||||
std::string background = triviaData[i]["background"];
|
std::string background = triviaData[i]["background"];
|
||||||
|
if (triviaData[i].contains("scenery"))
|
||||||
|
sceneryName = triviaData[i]["scenery"];
|
||||||
|
|
||||||
// divide trivia into multiple lines - UTF-8 safe implementation
|
// divide trivia into multiple lines - UTF-8 safe implementation
|
||||||
// Different languages need different character limits due to character width differences
|
// 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
|
// Progress bar at the bottom of the screen
|
||||||
const auto p1 = ImVec2(0, Global.window_size.y - 2);
|
const auto p1 = ImVec2(0, Global.window_size.y - 2);
|
||||||
const auto p2 = ImVec2(Global.window_size.x * m_progress, Global.window_size.y);
|
const auto p2 = ImVec2(Global.window_size.x * m_progress, Global.window_size.y);
|
||||||
|
|||||||
@@ -30,4 +30,9 @@ private:
|
|||||||
std::vector<std::string> get_random_trivia();
|
std::vector<std::string> get_random_trivia();
|
||||||
void generate_gradient_tex();
|
void generate_gradient_tex();
|
||||||
void load_wheel_frames();
|
void load_wheel_frames();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Scenery name for eligable trivias
|
||||||
|
/// </summary>
|
||||||
|
std::string sceneryName;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user