Skip to content
Snippets Groups Projects
Commit bfb3166c authored by Oliver Behnke's avatar Oliver Behnke
Browse files

HDPI: fix canvas adjustment

parent b1102a4f
No related branches found
No related tags found
No related merge requests found
......@@ -81,7 +81,7 @@ bool WindowManager::initialize(const int width, const int height, const int fram
// set common video flags
m_VideoModeFlags = SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE;
// enable HDPI (retina) support
// m_VideoModeFlags |= SDL_WINDOW_ALLOW_HIGHDPI;
m_VideoModeFlags |= SDL_WINDOW_ALLOW_HIGHDPI;
// check fullscreen video mode
m_FullscreenModeAvailable = true;
......@@ -279,9 +279,21 @@ void WindowManager::eventLoop()
AbstractGraphicsEngine::MouseButtonRight);
}
}
else if (event.window.event == SDL_WINDOWEVENT_EXPOSED) {
// adjust to current canvas size
SDL_GL_GetDrawableSize(m_Window, &m_CurrentWidth, &m_CurrentHeight);
// notify our observers (currently exactly one, hence front())
// (windoze needs to be reinitialized instead of just resized, oh well)
/// \todo Can we determine the host OS? On X11 a resize() is sufficient!
eventObservers.front()->initialize(m_CurrentWidth, m_CurrentHeight, 0, true);
}
else if (event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED) {
m_CurrentWidth = m_WindowedWidth = event.window.data1;
m_CurrentHeight = m_WindowedHeight = event.window.data2;
m_WindowedWidth = event.window.data1;
m_WindowedHeight = event.window.data2;
// adjust to current canvas size
SDL_GL_GetDrawableSize(m_Window, &m_CurrentWidth, &m_CurrentHeight);
// notify our observers (currently exactly one, hence front())
// (windoze needs to be reinitialized instead of just resized, oh well)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment