mirror of
https://github.com/love2d/love.git
synced 2026-08-16 08:11:02 +02:00
Fixture:getShape() returns a Shape of the type it actually is
--HG-- branch : box2d-update
This commit is contained in:
@@ -119,7 +119,23 @@ namespace box2d
|
||||
if(shape == 0)
|
||||
return 0;
|
||||
shape->retain();
|
||||
luax_newtype(L, "Shape", PHYSICS_SHAPE_T, (void*)shape);
|
||||
switch (shape->getType()) {
|
||||
case Shape::SHAPE_EDGE:
|
||||
luax_newtype(L, "EdgeShape", PHYSICS_EDGE_SHAPE_T, (void*)shape);
|
||||
break;
|
||||
case Shape::SHAPE_CHAIN:
|
||||
luax_newtype(L, "ChainShape", PHYSICS_CHAIN_SHAPE_T, (void*)shape);
|
||||
break;
|
||||
case Shape::SHAPE_CIRCLE:
|
||||
luax_newtype(L, "CircleShape", PHYSICS_CIRCLE_SHAPE_T, (void*)shape);
|
||||
break;
|
||||
case Shape::SHAPE_POLYGON:
|
||||
luax_newtype(L, "PolygonShape", PHYSICS_POLYGON_SHAPE_T, (void*)shape);
|
||||
break;
|
||||
default:
|
||||
luax_newtype(L, "Shape", PHYSICS_SHAPE_T, (void*)shape);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user