Browse Source

metal: fix window pixel size when resizing

Alex Szpakowski 3 years ago
parent
commit
6e35ffe2d8
1 changed files with 11 additions and 1 deletions
  1. 11 1
      src/modules/window/sdl/Window.cpp

+ 11 - 1
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())
 	{