1 /**
2  * Copyright (c) 2006-2019 LOVE Development Team
3  *
4  * This software is provided 'as-is', without any express or implied
5  * warranty.  In no event will the authors be held liable for any damages
6  * arising from the use of this software.
7  *
8  * Permission is granted to anyone to use this software for any purpose,
9  * including commercial applications, and to alter it and redistribute it
10  * freely, subject to the following restrictions:
11  *
12  * 1. The origin of this software must not be misrepresented; you must not
13  *    claim that you wrote the original software. If you use this software
14  *    in a product, an acknowledgment in the product documentation would be
15  *    appreciated but is not required.
16  * 2. Altered source versions must be plainly marked as such, and must not be
17  *    misrepresented as being the original software.
18  * 3. This notice may not be removed or altered from any source distribution.
19  **/
20 
21 #include "wrap_PolygonShape.h"
22 
23 namespace love
24 {
25 namespace physics
26 {
27 namespace box2d
28 {
29 
luax_checkpolygonshape(lua_State * L,int idx)30 PolygonShape *luax_checkpolygonshape(lua_State *L, int idx)
31 {
32 	return luax_checktype<PolygonShape>(L, idx);
33 }
34 
w_PolygonShape_getPoints(lua_State * L)35 int w_PolygonShape_getPoints(lua_State *L)
36 {
37 	PolygonShape *t = luax_checkpolygonshape(L, 1);
38 	lua_remove(L, 1);
39 	return t->getPoints(L);
40 }
41 
w_PolygonShape_validate(lua_State * L)42 int w_PolygonShape_validate(lua_State *L)
43 {
44 	PolygonShape *t = luax_checkpolygonshape(L, 1);
45 	luax_pushboolean(L, t->validate());
46 	return 1;
47 }
48 
49 static const luaL_Reg w_PolygonShape_functions[] =
50 {
51 	{ "getPoints", w_PolygonShape_getPoints },
52 	{ "validate", w_PolygonShape_validate },
53 	{ 0, 0 }
54 };
55 
luaopen_polygonshape(lua_State * L)56 extern "C" int luaopen_polygonshape(lua_State *L)
57 {
58 	return luax_register_type(L, &PolygonShape::type, w_Shape_functions, w_PolygonShape_functions, nullptr);
59 }
60 
61 } // box2d
62 } // physics
63 } // love
64