diff --git a/Minecraft.Client/Assets/UI/HelpOptions.rcss b/Minecraft.Client/Assets/UI/HelpOptions.rcss index 96b671bb..ad478c34 100644 --- a/Minecraft.Client/Assets/UI/HelpOptions.rcss +++ b/Minecraft.Client/Assets/UI/HelpOptions.rcss @@ -3,8 +3,8 @@ body width: 100%; height: 100%; font-family: Minecraft Default; - font-size: 14px; - font-effect: shadow(1px 1px #000000); + font-size: 14dp; + font-effect: shadow(1dp 1dp #000000); color: #ffffff; background: transparent; display: flex; @@ -14,13 +14,13 @@ body div#help_options_menu { - width: 624px; - height: auto; + width: 624dp; + height: 330dp; margin: auto; background: rgba(0, 0, 0, 0.65); - border: 2px solid #555555; - border-radius: 8px; - padding: 40px 48px; + border: 2dp solid #555555; + border-radius: 8dp; + padding: 40dp 48dp; } div#buttons @@ -34,13 +34,13 @@ div#buttons button { display: block; - width: 524px; - height: 64px; - margin-bottom: 11px; + width: 674dp; + height: 60dp; + margin-bottom: 15dp; color: #ffffff; - font-size: 25px; + font-size: 36dp; text-align: center; - line-height: 64px; + line-height: 60dp; cursor: pointer; border: none; background: transparent; @@ -49,5 +49,6 @@ button button:hover { + color: #ffff00; decorator: image(images/lce/Button/MainMenuButton_Over.png); } diff --git a/Minecraft.Client/Assets/UI/HelpOptions.rml b/Minecraft.Client/Assets/UI/HelpOptions.rml index 6156124d..2b579398 100644 --- a/Minecraft.Client/Assets/UI/HelpOptions.rml +++ b/Minecraft.Client/Assets/UI/HelpOptions.rml @@ -7,7 +7,7 @@
- + diff --git a/Minecraft.Client/Assets/UI/PauseMenu.rcss b/Minecraft.Client/Assets/UI/PauseMenu.rcss index 93129382..fa8d28d3 100644 --- a/Minecraft.Client/Assets/UI/PauseMenu.rcss +++ b/Minecraft.Client/Assets/UI/PauseMenu.rcss @@ -3,8 +3,8 @@ body width: 100%; height: 100%; font-family: Minecraft Default; - font-size: 14px; - font-effect: shadow(1px 1px #000000); + font-size: 14dp; + font-effect: shadow(1dp 1dp #000000); color: #ffffff; background: transparent; display: flex; @@ -14,13 +14,13 @@ body div#pause_menu { - width: 624px; - height: auto; + width: 624dp; + height: 330dp; margin: auto; background: rgba(0, 0, 0, 0.65); - border: 2px solid #555555; - border-radius: 8px; - padding: 40px 48px; + border: 2dp solid #555555; + border-radius: 8dp; + padding: 40dp 48dp; } div#buttons @@ -34,13 +34,13 @@ div#buttons button { display: block; - width: 524px; - height: 64px; - margin-bottom: 11px; + width: 674dp; + height: 60dp; + margin-bottom: 15dp; color: #ffffff; - font-size: 25px; + font-size: 36dp; text-align: center; - line-height: 64px; + line-height: 60dp; cursor: pointer; border: none; background: transparent; @@ -49,6 +49,7 @@ button button:hover { + color: #ffff00; decorator: image(images/lce/Button/MainMenuButton_Over.png); } @@ -56,15 +57,15 @@ div#exit_dialog { display: none; width: 100%; - margin-top: 16px; + margin-top: 16dp; text-align: center; } p#exit_text { - font-size: 31px; + font-size: 31dp; color: #ffffff; - margin-bottom: 23px; + margin-bottom: 23dp; } div#exit_buttons @@ -72,7 +73,7 @@ div#exit_buttons width: 100%; display: flex; justify-content: center; - gap: 10px; + gap: 10dp; flex-wrap: wrap; } @@ -82,15 +83,15 @@ button#exit_cancel { display: inline-block; width: auto; - min-width: 233px; - height: 58px; + min-width: 233dp; + height: 58dp; margin: 0; - padding-left: 29px; - padding-right: 29px; + padding-left: 29dp; + padding-right: 29dp; color: #ffffff; - font-size: 22px; + font-size: 36dp; text-align: center; - line-height: 58px; + line-height: 58dp; cursor: pointer; border: none; background: transparent; @@ -101,6 +102,7 @@ button#exit_save:hover, button#exit_nosave:hover, button#exit_cancel:hover { + color: #ffff00; decorator: image(images/lce/Button/MainMenuButton_Over.png); } @@ -108,15 +110,15 @@ div#save_dialog { display: none; width: 100%; - margin-top: 16px; + margin-top: 16dp; text-align: center; } p#save_text { - font-size: 31px; + font-size: 36dp; color: #ffffff; - margin-bottom: 23px; + margin-bottom: 23dp; } div#save_buttons @@ -124,7 +126,7 @@ div#save_buttons width: 100%; display: flex; justify-content: center; - gap: 10px; + gap: 10dp; } button#save_cancel, @@ -132,15 +134,15 @@ button#save_confirm { display: inline-block; width: auto; - min-width: 204px; - height: 58px; + min-width: 204dp; + height: 58dp; margin: 0; - padding-left: 29px; - padding-right: 29px; + padding-left: 29dp; + padding-right: 29dp; color: #ffffff; - font-size: 22px; + font-size: 36dp; text-align: center; - line-height: 58px; + line-height: 58dp; cursor: pointer; border: none; background: transparent; @@ -150,5 +152,6 @@ button#save_confirm button#save_cancel:hover, button#save_confirm:hover { + color: #ffff00; decorator: image(images/lce/Button/MainMenuButton_Over.png); } diff --git a/Minecraft.Client/Assets/UI/SettingsMenu.rcss b/Minecraft.Client/Assets/UI/SettingsMenu.rcss index dd18ea63..57d3e633 100644 --- a/Minecraft.Client/Assets/UI/SettingsMenu.rcss +++ b/Minecraft.Client/Assets/UI/SettingsMenu.rcss @@ -3,8 +3,8 @@ body width: 100%; height: 100%; font-family: Minecraft Default; - font-size: 14px; - font-effect: shadow(1px 1px #000000); + font-size: 14dp; + font-effect: shadow(1dp 1dp #000000); color: #ffffff; background: transparent; display: flex; @@ -14,13 +14,13 @@ body div#settings_menu { - width: 624px; - height: auto; + width: 624dp; + height: 330dp; margin: auto; background: rgba(0, 0, 0, 0.65); - border: 2px solid #555555; - border-radius: 8px; - padding: 40px 48px; + border: 2dp solid #555555; + border-radius: 8dp; + padding: 40dp 48dp; } div#buttons @@ -34,13 +34,13 @@ div#buttons button { display: block; - width: 524px; - height: 64px; - margin-bottom: 11px; + width: 674dp; + height: 60dp; + margin-bottom: 15dp; color: #ffffff; - font-size: 25px; + font-size: 36dp; text-align: center; - line-height: 64px; + line-height: 60dp; cursor: pointer; border: none; background: transparent; @@ -49,6 +49,7 @@ button button:hover { + color: #ffff00; decorator: image(images/lce/Button/MainMenuButton_Over.png); } @@ -56,15 +57,15 @@ div#confirm_dialog { display: none; width: 100%; - margin-top: 16px; + margin-top: 16dp; text-align: center; } p#confirm_text { - font-size: 31px; + font-size: 31dp; color: #ffffff; - margin-bottom: 23px; + margin-bottom: 23dp; } div#confirm_buttons @@ -72,7 +73,7 @@ div#confirm_buttons width: 100%; display: flex; justify-content: center; - gap: 10px; + gap: 10dp; } button#confirm_no, @@ -80,15 +81,15 @@ button#confirm_yes { display: inline-block; width: auto; - min-width: 204px; - height: 58px; + min-width: 204dp; + height: 58dp; margin: 0; - padding-left: 29px; - padding-right: 29px; + padding-left: 29dp; + padding-right: 29dp; color: #ffffff; - font-size: 22px; + font-size: 36dp; text-align: center; - line-height: 58px; + line-height: 58dp; cursor: pointer; border: none; background: transparent; @@ -98,5 +99,6 @@ button#confirm_yes button#confirm_no:hover, button#confirm_yes:hover { + color: #ffff00; decorator: image(images/lce/Button/MainMenuButton_Over.png); } diff --git a/Minecraft.Client/RmlManager.cpp b/Minecraft.Client/RmlManager.cpp index 8558a7a5..1cb958f8 100644 --- a/Minecraft.Client/RmlManager.cpp +++ b/Minecraft.Client/RmlManager.cpp @@ -72,11 +72,16 @@ bool RmlManager::Init(int viewport_width, int viewport_height) Rml::Shutdown(); return false; } + app.DebugPrintf("[RmlManager] Context created (%dx%d)\n", viewport_width, viewport_height); m_renderer->SetViewport(viewport_width, viewport_height); m_initialised = true; + app.DebugPrintf("[RmlManager] Initialised (%dx%d)\n", viewport_width, viewport_height); + + UpdateDpRatio(); + return true; } @@ -106,6 +111,7 @@ void RmlManager::Update() { if (!m_initialised || !m_context) return; + m_context->Update(); } @@ -154,3 +160,34 @@ void RmlManager::OnResize(int width, int height) m_context->SetDimensions(Rml::Vector2i(width, height)); m_renderer->SetViewport(width, height); } + +// GabsPuN: Taken from the Quake port as something temporary +void RmlManager::UpdateDpRatio() +{ + if (!m_context) + return; + + int width = GetSystemMetrics(SM_CXSCREEN); + int height = GetSystemMetrics(SM_CYSCREEN); + + float scale_x = static_cast(width) / 1920; + float scale_y = static_cast(height) / 1080; + float base_ratio = (scale_x < scale_y) ? scale_x : scale_y; + + float blend = (base_ratio > 1.0f) ? std::min(base_ratio - 1.0f, 1.0f) : 0.0f; + float effective_dpi = (1.0f - blend) + blend; + + float auto_dp = base_ratio * effective_dpi; + float viewport_cap = 0.88f * static_cast(height) / 850.0f; + if (auto_dp > viewport_cap) + auto_dp = viewport_cap; + + float dp_ratio = auto_dp; + + if (dp_ratio < 0.5f) + dp_ratio = 0.5f; + if (dp_ratio > 3.0f) + dp_ratio = 3.0f; + + m_context->SetDensityIndependentPixelRatio(dp_ratio); +} \ No newline at end of file diff --git a/Minecraft.Client/RmlManager.h b/Minecraft.Client/RmlManager.h index e9af36da..5b4a4ae4 100644 --- a/Minecraft.Client/RmlManager.h +++ b/Minecraft.Client/RmlManager.h @@ -31,6 +31,7 @@ public: RenderInterface_D3D11* GetRenderInterface() const { return m_renderer.get(); } void OnResize(int width, int height); + void UpdateDpRatio(); private: RmlManager();