mirror of
https://github.com/hedge-dev/UnleashedRecomp
synced 2026-05-26 15:46:18 -04:00
Dpi fixes (#449)
* Potential fix for DPI scaling. * Show window size in pixels while in Fullscreen mode.
This commit is contained in:
@@ -378,6 +378,11 @@ SDL_Rect GameWindow::GetDimensions()
|
||||
return rect;
|
||||
}
|
||||
|
||||
void GameWindow::GetSizeInPixels(int *w, int *h)
|
||||
{
|
||||
SDL_GetWindowSizeInPixels(s_pWindow, w, h);
|
||||
}
|
||||
|
||||
void GameWindow::SetDimensions(int w, int h, int x, int y)
|
||||
{
|
||||
s_width = w;
|
||||
|
||||
@@ -37,6 +37,7 @@ public:
|
||||
static bool IsMaximised();
|
||||
static EWindowState SetMaximised(bool isEnabled);
|
||||
static SDL_Rect GetDimensions();
|
||||
static void GetSizeInPixels(int *w, int *h);
|
||||
static void SetDimensions(int w, int h, int x = SDL_WINDOWPOS_CENTERED, int y = SDL_WINDOWPOS_CENTERED);
|
||||
static void ResetDimensions();
|
||||
static uint32_t GetWindowFlags();
|
||||
|
||||
@@ -1121,17 +1121,25 @@ static void DrawConfigOption(int32_t rowIndex, float yOffset, ConfigDef<T>* conf
|
||||
{
|
||||
if (config == &Config::WindowSize)
|
||||
{
|
||||
auto displayModes = GameWindow::GetDisplayModes();
|
||||
|
||||
if (config->Value >= 0 && config->Value < displayModes.size())
|
||||
if (Config::Fullscreen)
|
||||
{
|
||||
auto& displayMode = displayModes[config->Value];
|
||||
|
||||
valueText = fmt::format("{}x{}", displayMode.w, displayMode.h);
|
||||
int displayW, displayH;
|
||||
GameWindow::GetSizeInPixels(&displayW, &displayH);
|
||||
valueText = fmt::format("{}x{}", displayW, displayH);
|
||||
}
|
||||
else
|
||||
{
|
||||
valueText = fmt::format("{}x{}", GameWindow::s_width, GameWindow::s_height);
|
||||
auto displayModes = GameWindow::GetDisplayModes();
|
||||
if (config->Value >= 0 && config->Value < displayModes.size())
|
||||
{
|
||||
auto& displayMode = displayModes[config->Value];
|
||||
|
||||
valueText = fmt::format("{}x{}", displayMode.w, displayMode.h);
|
||||
}
|
||||
else
|
||||
{
|
||||
valueText = fmt::format("{}x{}", GameWindow::s_width, GameWindow::s_height);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (config == &Config::Monitor)
|
||||
|
||||
Reference in New Issue
Block a user