add custom event that fires on all window resize events

This commit is contained in:
ohsqueezy 2023-09-28 21:11:30 -04:00
parent a4435242f8
commit 5046b4bcf1
1 changed files with 4 additions and 1 deletions

View File

@ -171,12 +171,15 @@ void sb::Display::respond(SDL_Event& event)
sb::Log::Level level = event.window.event == SDL_WINDOWEVENT_RESIZED ? sb::Log::INFO : sb::Log::DEBUG;
sb::Log::log(message, level);
/* Resize the GL viewport */
/* Set the GL viewport to fill the window (this should probably be optional...) */
if (SDL_GL_GetCurrentContext() != nullptr)
{
glViewport(0, 0, event.window.data1, event.window.data2);
sb::Log::gl_errors("After glViewport resize");
}
/* Send a general window resize event to the framework */
Delegate::post("window resize");
}
}
}