fix(glsdl): move SDL event dispatching to different function

This commit is contained in:
superp00t 2024-03-05 01:52:10 -05:00
parent 962bcc6a1e
commit 8596860120
3 changed files with 5 additions and 0 deletions

View File

@ -1268,6 +1268,8 @@ void CGxDeviceGLSDL::SceneClear(uint32_t mask, CImVector color) {
} }
void CGxDeviceGLSDL::ScenePresent() { void CGxDeviceGLSDL::ScenePresent() {
this->m_GLSDLWindow.DispatchEvents();
if (this->m_context) { if (this->m_context) {
// TODO // TODO

View File

@ -209,7 +209,9 @@ void GLSDLWindow::Create(const char* title, const GLSDLWindowRect& rect, GLTextu
void GLSDLWindow::Swap() { void GLSDLWindow::Swap() {
SDL_GL_SwapWindow(this->m_sdlWindow); SDL_GL_SwapWindow(this->m_sdlWindow);
}
void GLSDLWindow::DispatchEvents() {
SDL_Event event; SDL_Event event;
while (SDL_PollEvent(&event)) { while (SDL_PollEvent(&event)) {
this->DispatchSDLEvent(event); this->DispatchSDLEvent(event);

View File

@ -30,6 +30,7 @@ class GLSDLWindow {
void Create(const char* title, const GLSDLWindowRect& rect, GLTextureFormat depthFormat, uint32_t sampleCount); void Create(const char* title, const GLSDLWindowRect& rect, GLTextureFormat depthFormat, uint32_t sampleCount);
void Destroy(); void Destroy();
void Swap(); void Swap();
void DispatchEvents();
void DispatchSDLEvent(const SDL_Event& event); void DispatchSDLEvent(const SDL_Event& event);
void DispatchSDLKeyboardEvent(const SDL_Event& event); void DispatchSDLKeyboardEvent(const SDL_Event& event);
void DispatchSDLMouseMotionEvent(const SDL_Event& event); void DispatchSDLMouseMotionEvent(const SDL_Event& event);