Browse Source

fixed mouse coordinates due to the love.window.getScale() change

fysx 12 years ago
parent
commit
bfae01300e

+ 2 - 0
jni/love/src/modules/event/sdl/Event.cpp

@@ -42,6 +42,7 @@ namespace sdl
 // we want them in pixel coordinates (may be different with high-DPI enabled.)
 static void windowToPixelCoords(int *x, int *y)
 {
+#ifndef LOVE_ANDROID
 	double scale = 1.0;
 
 	window::Window *window = (window::Window *) Module::findInstance("love.window.");
@@ -53,6 +54,7 @@ static void windowToPixelCoords(int *x, int *y)
 
 	if (y != nullptr)
 		*y = int(double(*y) * scale);
+#endif
 }
 
 

+ 4 - 0
jni/love/src/modules/mouse/sdl/Mouse.cpp

@@ -36,6 +36,7 @@ namespace sdl
 // we want them in pixel coordinates (may be different with high-DPI enabled.)
 static void windowToPixelCoords(int *x, int *y)
 {
+#ifndef LOVE_ANDROID
 	double scale = 1.0;
 
 	love::window::Window *window = love::window::sdl::Window::getSingleton();
@@ -47,11 +48,13 @@ static void windowToPixelCoords(int *x, int *y)
 
 	if (y != nullptr)
 		*y = int(double(*y) * scale);
+#endif
 }
 
 // And vice versa for setting mouse coordinates.
 static void pixelToWindowCoords(int *x, int *y)
 {
+#ifndef LOVE_ANDROID
 	double scale = 1.0;
 
 	love::window::Window *window = love::window::sdl::Window::getSingleton();
@@ -63,6 +66,7 @@ static void pixelToWindowCoords(int *x, int *y)
 
 	if (y != nullptr)
 		*y = int(double(*y) / scale);
+#endif
 }
 
 const char *Mouse::getName() const