Browse Source

Add love.graphics.getPixelDensity, gets the pixel density scale of the screen (matches other APIs).

--HG--
branch : minor
Alex Szpakowski 8 years ago
parent
commit
bfd1b86059
1 changed files with 7 additions and 0 deletions
  1. 7 0
      src/modules/graphics/opengl/wrap_Graphics.cpp

+ 7 - 0
src/modules/graphics/opengl/wrap_Graphics.cpp

@@ -195,6 +195,12 @@ int w_getPixelDimensions(lua_State *L)
 	return 2;
 	return 2;
 }
 }
 
 
+int w_getPixelDensity(lua_State *L)
+{
+	lua_pushnumber(L, instance()->getScreenPixelDensity());
+	return 1;
+}
+
 int w_setCanvas(lua_State *L)
 int w_setCanvas(lua_State *L)
 {
 {
 	// Disable stencil writes.
 	// Disable stencil writes.
@@ -2163,6 +2169,7 @@ static const luaL_Reg functions[] =
 	{ "getPixelWidth", w_getPixelWidth },
 	{ "getPixelWidth", w_getPixelWidth },
 	{ "getPixelHeight", w_getPixelHeight },
 	{ "getPixelHeight", w_getPixelHeight },
 	{ "getPixelDimensions", w_getPixelDimensions },
 	{ "getPixelDimensions", w_getPixelDimensions },
+	{ "getPixelDensity", w_getPixelDimensions },
 
 
 	{ "setScissor", w_setScissor },
 	{ "setScissor", w_setScissor },
 	{ "intersectScissor", w_intersectScissor },
 	{ "intersectScissor", w_intersectScissor },