1. Bill Meltsner
  2. love-ios

Commits

Bart van Strien  committed 4ec4e48

Add getWidth and getHeight to Canvas (issue #307)

  • Participants
  • Parent commits eb528f9
  • Branches default

Comments (0)

Files changed (2)

File src/modules/graphics/opengl/wrap_Canvas.cpp

View file
  • Ignore whitespace
 		return 0;
 	}
 
+	int w_Canvas_getWidth(lua_State * L)
+	{
+		Canvas * canvas = luax_checkcanvas(L, 1);
+		lua_pushnumber(L, canvas->getWidth());
+		return 1;
+	}
+
+	int w_Canvas_getHeight(lua_State * L)
+	{
+		Canvas * canvas = luax_checkcanvas(L, 1);
+		lua_pushnumber(L, canvas->getHeight());
+		return 1;
+	}
+
 	static const luaL_Reg functions[] = {
 		{ "renderTo", w_Canvas_renderTo },
 		{ "getImageData", w_Canvas_getImageData },
 		{ "setWrap", w_Canvas_setWrap },
 		{ "getWrap", w_Canvas_getWrap },
 		{ "clear", w_Canvas_clear },
+		{ "getWidth", w_Canvas_getWidth },
+		{ "getHeight", w_Canvas_getHeight },
 		{ 0, 0 }
 	};
 

File src/modules/graphics/opengl/wrap_Canvas.h

View file
  • Ignore whitespace
 	int w_Canvas_setWrap(lua_State * L);
 	int w_Canvas_getWrap(lua_State * L);
 	int w_Canvas_clear(lua_State * L);
+	int w_Canvas_getWidth(lua_State * L);
+	int w_Canvas_getHeight(lua_State * L);
 	int luaopen_canvas(lua_State * L);
 
 } // opengl