diff --git a/src/hooks/visual/SDL_GL_SwapWindow.cpp b/src/hooks/visual/SDL_GL_SwapWindow.cpp index a611b0ef..00b3f61a 100644 --- a/src/hooks/visual/SDL_GL_SwapWindow.cpp +++ b/src/hooks/visual/SDL_GL_SwapWindow.cpp @@ -9,6 +9,7 @@ #include "HookedMethods.hpp" #include "timer.hpp" #include +#include static bool init{ false }; static bool init_wminfo{ false }; @@ -44,10 +45,15 @@ DEFINE_HOOKED_METHOD(SDL_GL_SwapWindow, void, SDL_Window *window) if (isHackActive() && !disable_visuals) { + static int prev_width, prev_height; PROF_SECTION(SWAPWINDOW_cathook); - if (not init) + if (not init || draw::width != prev_width || draw::height != prev_height) { + prev_width = draw::width; + prev_height = draw::height; draw::InitGL(); + if (zerokernel::Menu::instance) + zerokernel::Menu::instance->resize(draw::width, draw::height); init = true; } draw::BeginGL(); diff --git a/src/hooks/visual/SDL_PollEvent.cpp b/src/hooks/visual/SDL_PollEvent.cpp index 63caf024..052ed6bb 100644 --- a/src/hooks/visual/SDL_PollEvent.cpp +++ b/src/hooks/visual/SDL_PollEvent.cpp @@ -5,7 +5,6 @@ #include #include "HookedMethods.hpp" - namespace hooked_methods { @@ -18,6 +17,7 @@ DEFINE_HOOKED_METHOD(SDL_PollEvent, int, SDL_Event *event) static Timer waitfirst{}; if (gui::handleSdlEvent(event)) return 0; + g_IEngine->GetScreenSize(draw::width, draw::height); #endif return ret; }