mirror of https://github.com/bjornbytes/lovr.git
Shape:isEnabled; Shape:setEnabled;
This commit is contained in:
parent
bca3335da8
commit
e93bfb30ad
|
@ -31,3 +31,16 @@ int l_lovrShapeSetBody(lua_State* L) {
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int l_lovrShapeIsEnabled(lua_State* L) {
|
||||||
|
Shape* shape = luax_checktypeof(L, 1, Shape);
|
||||||
|
lua_pushboolean(L, lovrShapeIsEnabled(shape));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int l_lovrShapeSetEnabled(lua_State* L) {
|
||||||
|
Shape* shape = luax_checktypeof(L, 1, Shape);
|
||||||
|
int enabled = lua_toboolean(L, 2);
|
||||||
|
lovrShapeSetEnabled(shape, enabled);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
@ -284,4 +284,14 @@ void lovrShapeSetBody(Shape* shape, Body* body) {
|
||||||
dGeomSetBody(shape->id, body ? body->id : 0);
|
dGeomSetBody(shape->id, body ? body->id : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int lovrShapeIsEnabled(Shape* shape) {
|
||||||
|
return dGeomIsEnabled(shape->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
void lovrShapeSetEnabled(Shape* shape, int enabled) {
|
||||||
|
if (enabled) {
|
||||||
|
dGeomEnable(shape->id);
|
||||||
|
} else {
|
||||||
|
dGeomDisable(shape->id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,3 +78,5 @@ void lovrShapeDestroy(const Ref* ref);
|
||||||
ShapeType lovrShapeGetType(Shape* shape);
|
ShapeType lovrShapeGetType(Shape* shape);
|
||||||
Body* lovrShapeGetBody(Shape* shape);
|
Body* lovrShapeGetBody(Shape* shape);
|
||||||
void lovrShapeSetBody(Shape* shape, Body* body);
|
void lovrShapeSetBody(Shape* shape, Body* body);
|
||||||
|
int lovrShapeIsEnabled(Shape* shape);
|
||||||
|
void lovrShapeSetEnabled(Shape* shape, int enabled);
|
||||||
|
|
Loading…
Reference in New Issue