Implemented camera aspect ratio hooks

This commit is contained in:
Hyper
2024-10-17 19:15:36 +01:00
parent 02c9484c9c
commit 3c1c13e4ce
17 changed files with 307 additions and 7 deletions
+2 -1
View File
@@ -87,7 +87,7 @@ 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, 1280, 720, SDL_WINDOW_RESIZABLE);
s_window = SDL_CreateWindow(title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, Window::s_width, Window::s_height, SDL_WINDOW_RESIZABLE);
if (auto icon = GetIconSurface())
{
@@ -95,6 +95,7 @@ void Window::Init()
SDL_FreeSurface(icon);
}
SetWindowDimensions();
SetFullscreen(Config::Fullscreen);
SDL_SysWMinfo info;
+6 -3
View File
@@ -13,8 +13,8 @@ public:
inline static bool s_isFocused;
inline static int s_width;
inline static int s_height;
inline static int s_width = 1280;
inline static int s_height = 720;
static SDL_Surface* GetIconSurface(void* pIconBmp = nullptr, size_t iconSize = 0)
{
@@ -81,7 +81,7 @@ public:
}
}
static void SetWindowDimensions(int w, int h)
static void SetWindowDimensions(int w = -1, int h = -1)
{
auto width = w <= 0 ? Config::Width : w;
auto height = h <= 0 ? Config::Height : h;
@@ -97,6 +97,9 @@ public:
SDL_SetWindowMinimumSize(s_window, 640, 480);
SDL_SetWindowPosition(s_window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
s_width = width;
s_height = height;
if (!isPendingMaximise)
return;