mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-17 23:39:18 +02:00
scenarioloaderuilayer: Scale the loading screen to the window size
This commit is contained in:
@@ -197,7 +197,8 @@ void scenarioloader_ui::render_()
|
||||
ImDrawList* draw_list = ImGui::GetWindowDrawList();
|
||||
ImGui::PushFont(font_loading);
|
||||
ImGui::SetWindowFontScale(1);
|
||||
const float font_scale_mult = 48 / ImGui::GetFontSize();
|
||||
const float scale = Global.window_size.x / 1920.f;
|
||||
const float font_scale_mult = 48 / ImGui::GetFontSize() * scale;
|
||||
|
||||
// Gradient at the lower half of the screen
|
||||
if (!Global.NvRenderer)
|
||||
@@ -207,14 +208,14 @@ void scenarioloader_ui::render_()
|
||||
}
|
||||
|
||||
// [O] Loading...
|
||||
const float margin_left_icon = 35.0f;
|
||||
const float margin_bottom_loading = 80.0f;
|
||||
const float spacing = 10.0f; // odstęp między ikoną a tekstem
|
||||
const float margin_left_icon = 35.0f * scale;
|
||||
const float margin_bottom_loading = 80.0f * scale;
|
||||
const float spacing = 10.0f * scale; // odstęp między ikoną a tekstem
|
||||
|
||||
// Loading icon
|
||||
const deferred_image *img = &m_loading_wheel_frames[38];
|
||||
const auto loading_tex = img->get();
|
||||
const auto loading_size = img->size();
|
||||
const auto loading_size = glm::vec2(img->size()) * glm::vec2(scale);
|
||||
|
||||
ImVec2 icon_pos(margin_left_icon, screen_size.y - margin_bottom_loading - loading_size.y);
|
||||
|
||||
@@ -235,10 +236,10 @@ void scenarioloader_ui::render_()
|
||||
// draw only if we have any trivia loaded
|
||||
if (m_trivia.size() > 0)
|
||||
{
|
||||
const float margin_right = 80.0f;
|
||||
const float margin_bottom = 80.0f;
|
||||
const float line_spacing = 25.0f;
|
||||
const float header_gap = 10.0f;
|
||||
const float margin_right = 80.0f * scale;
|
||||
const float margin_bottom = 80.0f * scale;
|
||||
const float line_spacing = 25.0f * scale;
|
||||
const float header_gap = 10.0f * scale;
|
||||
|
||||
// Measure width of trivia lines
|
||||
ImGui::SetWindowFontScale(font_scale_mult * 0.6f);
|
||||
@@ -283,7 +284,7 @@ void scenarioloader_ui::render_()
|
||||
if (!sceneryName.empty())
|
||||
{
|
||||
ImVec2 text_size = ImGui::CalcTextSize(sceneryName.c_str());
|
||||
ImVec2 text_pos = ImVec2(screen_size.x - 16 - text_size.x, 16);
|
||||
ImVec2 text_pos = ImVec2(screen_size.x - 16 * scale - text_size.x, 16 * scale);
|
||||
draw_list->AddText(text_pos, IM_COL32_WHITE, sceneryName.c_str());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user