mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-03-13 18:10:08 -05:00
Config: implemented toml reading
This commit is contained in:
@@ -87,7 +87,12 @@ void Window::Init()
|
||||
SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE);
|
||||
SDL_AddEventWatch(Window_OnSDLEvent, s_window);
|
||||
|
||||
s_window = SDL_CreateWindow(title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, Window::s_width, Window::s_height, SDL_WINDOW_RESIZABLE);
|
||||
s_window = SDL_CreateWindow(title,
|
||||
SDL_WINDOWPOS_CENTERED,
|
||||
SDL_WINDOWPOS_CENTERED,
|
||||
Config::WindowWidth,
|
||||
Config::WindowHeight,
|
||||
SDL_WINDOW_RESIZABLE);
|
||||
|
||||
if (auto icon = GetIconSurface())
|
||||
{
|
||||
|
||||
@@ -29,8 +29,8 @@ public:
|
||||
|
||||
static bool IsDisplayResolution(int w, int h, bool isExact = true)
|
||||
{
|
||||
auto width = w <= 0 ? Config::Width : w;
|
||||
auto height = h <= 0 ? Config::Height : h;
|
||||
auto width = w <= 0 ? Config::WindowWidth : w;
|
||||
auto height = h <= 0 ? Config::WindowHeight : h;
|
||||
|
||||
SDL_Rect displayRect;
|
||||
if (SDL_GetDisplayBounds(SDL_GetWindowDisplayIndex(s_window), &displayRect) == ERROR_SUCCESS)
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
if (SDL_GetDisplayBounds(SDL_GetWindowDisplayIndex(s_window), &displayRect) == ERROR_SUCCESS)
|
||||
{
|
||||
// Maximise window if the config resolution is greater than the display.
|
||||
if (IsDisplayResolution(Config::Width, Config::Height, false))
|
||||
if (IsDisplayResolution(s_width, s_height, false))
|
||||
SDL_MaximizeWindow(s_window);
|
||||
}
|
||||
|
||||
@@ -83,8 +83,8 @@ public:
|
||||
|
||||
static void SetWindowDimensions(int w = -1, int h = -1)
|
||||
{
|
||||
auto width = w <= 0 ? Config::Width : w;
|
||||
auto height = h <= 0 ? Config::Height : h;
|
||||
auto width = w <= 0 ? Config::WindowWidth : w;
|
||||
auto height = h <= 0 ? Config::WindowHeight : h;
|
||||
auto isPendingMaximise = false;
|
||||
|
||||
if (IsDisplayResolution(width, height))
|
||||
|
||||
Reference in New Issue
Block a user