From 6e35ffe2d8ba2900d284c50642210cf8e2c323a4 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Sat, 19 Feb 2022 14:17:37 -0400 Subject: [PATCH] metal: fix window pixel size when resizing --- src/modules/window/sdl/Window.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/modules/window/sdl/Window.cpp b/src/modules/window/sdl/Window.cpp index 839d55d6e..234e95887 100644 --- a/src/modules/window/sdl/Window.cpp +++ b/src/modules/window/sdl/Window.cpp @@ -660,7 +660,17 @@ bool Window::onSizeChanged(int width, int height) windowWidth = width; windowHeight = height; - SDL_GL_GetDrawableSize(window, &pixelWidth, &pixelHeight); + if (glcontext != nullptr) + SDL_GL_GetDrawableSize(window, &pixelWidth, &pixelHeight); +#ifdef LOVE_GRAPHICS_METAL + else if (metalView != nullptr) + SDL_Metal_GetDrawableSize(window, &pixelWidth, &pixelHeight); +#endif + else + { + pixelWidth = width; + pixelHeight = height; + } if (graphics.get()) {