Use SDL_GetRendererOutputSize instead of SDL_GetWindowSize

SDL_GetRendererOutputSize will always return the actual size, even in
some obscure HiDPI/macOS cases.
This commit is contained in:
leo60228 2020-12-31 21:00:20 -05:00 committed by Ethan Lee
parent d9fff2a8c3
commit 46d8599f62
1 changed files with 2 additions and 2 deletions

View File

@ -170,7 +170,7 @@ void Screen::ResizeScreen(int x, int y)
if (stretchMode == 1)
{
int winX, winY;
SDL_GetWindowSize(m_window, &winX, &winY);
SDL_GetRendererOutputSize(m_renderer, &winX, &winY);
int result = SDL_RenderSetLogicalSize(m_renderer, winX, winY);
if (result != 0)
{
@ -256,7 +256,7 @@ void Screen::ResizeToNearestMultiple()
void Screen::GetWindowSize(int* x, int* y)
{
SDL_GetWindowSize(m_window, x, y);
SDL_GetRendererOutputSize(m_renderer, x, y);
}
void Screen::UpdateScreen(SDL_Surface* buffer, SDL_Rect* rect )