feat: add DPI awareness and auto-detect screen resolution

This commit is contained in:
daoge_cmd
2026-03-01 21:22:02 +08:00
parent f90c74d9a3
commit 8b1dafd361
3 changed files with 21 additions and 9 deletions

View File

@@ -426,36 +426,36 @@ void UIController::loadSkins()
#elif defined __PSVITA__
platformSkinPath = L"skinVita.swf";
#elif defined _WINDOWS64
if(m_fScreenHeight==1080.0f)
if(m_fScreenHeight>=1080.0f)
{
platformSkinPath = L"skinHDWin.swf";
}
else
{
platformSkinPath = L"skinWin.swf";
platformSkinPath = L"skinWin.swf";
}
#elif defined _DURANGO
if(m_fScreenHeight==1080.0f)
if(m_fScreenHeight>=1080.0f)
{
platformSkinPath = L"skinHDDurango.swf";
platformSkinPath = L"skinHDDurango.swf";
}
else
{
platformSkinPath = L"skinDurango.swf";
platformSkinPath = L"skinDurango.swf";
}
#elif defined __ORBIS__
if(m_fScreenHeight==1080.0f)
if(m_fScreenHeight>=1080.0f)
{
platformSkinPath = L"skinHDOrbis.swf";
platformSkinPath = L"skinHDOrbis.swf";
}
else
{
platformSkinPath = L"skinOrbis.swf";
platformSkinPath = L"skinOrbis.swf";
}
#endif
// Every platform has one of these, so nothing shared
if(m_fScreenHeight==1080.0f)
if(m_fScreenHeight>=1080.0f)
{
m_iggyLibraries[eLibrary_Platform] = loadSkin(platformSkinPath, L"platformskinHD.swf");
}

View File

@@ -698,6 +698,17 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
// Declare DPI awareness so GetSystemMetrics returns physical pixels
SetProcessDPIAware();
g_iScreenWidth = GetSystemMetrics(SM_CXSCREEN);
g_iScreenHeight = GetSystemMetrics(SM_CYSCREEN);
{
char buf[128];
sprintf(buf, "Screen resolution: %dx%d\n", g_iScreenWidth, g_iScreenHeight);
OutputDebugStringA(buf);
}
if(lpCmdLine)
{
if(lpCmdLine[0] == '1')

View File

@@ -12,6 +12,7 @@ This project contains the source code of Minecraft Legacy Console Edition v1.3.0
- Added support for keyboard and mouse input
- Added fullscreen mode support (toggle using F11)
- Disabled V-Sync for better performance
- Auto-detect native monitor resolution with DPI awareness, resulting in sharper visuals on high-resolution displays
## Build & Run