Fix some glez resize issues

This commit is contained in:
LightCat 2019-01-06 13:26:26 +01:00
parent a11631dc96
commit e99a441066
2 changed files with 8 additions and 2 deletions

View File

@ -9,6 +9,7 @@
#include "HookedMethods.hpp"
#include "timer.hpp"
#include <SDL2/SDL_syswm.h>
#include <menu/menu/Menu.hpp>
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();

View File

@ -5,7 +5,6 @@
#include <menu/GuiInterface.hpp>
#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;
}