Mobile UI scaling and live safe-area relayout (mobile step 5)

Phones and tablets pick the logical UI size from the screen (height
600..768 from the dp height, width from the aspect ratio) instead of
letterboxing 1024x768; metin2.cfg is left untouched via a display-size
override. --phone/--safe-insets/--ui-height simulate on desktop. The
mobile HUD rebuilds and re-adopts the original windows when the safe
area changes. Keeps HUD gauge backgrounds alive and fixes the step-4
disc pixel check threshold.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-10-12 21:39:58 +09:00
co-authored by Claude Opus 5.5
parent 11bd94d1ce
commit ed2c185135
10 changed files with 232 additions and 23 deletions
+8 -2
View File
@@ -229,12 +229,18 @@ int CPythonSystem::GetFrequencyIndex(int res_index, uint32_t frequency)
uint32_t CPythonSystem::GetWidth()
{
return m_Config.width;
return m_displayWidth ? m_displayWidth : m_Config.width;
}
uint32_t CPythonSystem::GetHeight()
{
return m_Config.height;
return m_displayHeight ? m_displayHeight : m_Config.height;
}
void CPythonSystem::SetDisplaySizeOverride(uint32_t width, uint32_t height)
{
m_displayWidth = width;
m_displayHeight = height;
}
uint32_t CPythonSystem::GetBPP()
+4
View File
@@ -145,6 +145,9 @@ public:
uint32_t GetWidth();
uint32_t GetHeight();
// Mobile: the logical UI size chosen from the screen (platform::ChooseMobileLogicalSize).
// GetWidth/GetHeight report it; metin2.cfg keeps its own WIDTH/HEIGHT.
void SetDisplaySizeOverride(uint32_t width, uint32_t height);
uint32_t GetBPP();
uint32_t GetFrequency();
bool IsSoftwareCursor();
@@ -260,6 +263,7 @@ protected:
int m_ResolutionCount = 0;
TConfig m_Config;
uint32_t m_displayWidth = 0, m_displayHeight = 0;
TConfig m_OldConfig;
bool m_isInterfaceConfig = false;