mirror of
https://github.com/love2d/love.git
synced 2026-08-18 19:54:22 +02:00
Finally abstracted constants properly. Changed how the event module works; wasn't really abstract before. Removed libs we're not going to use: native, signal.
This commit is contained in:
@@ -56,7 +56,7 @@ namespace box2d
|
||||
joint = 0;
|
||||
}
|
||||
|
||||
int Joint::getType() const
|
||||
Joint::Type Joint::getType() const
|
||||
{
|
||||
switch(joint->GetType())
|
||||
{
|
||||
@@ -73,7 +73,7 @@ namespace box2d
|
||||
case e_gearJoint:
|
||||
return JOINT_GEAR;
|
||||
default:
|
||||
return -1;
|
||||
return JOINT_INVALID;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace box2d
|
||||
/**
|
||||
* Gets the type of joint.
|
||||
**/
|
||||
int getType() const;
|
||||
Type getType() const;
|
||||
|
||||
/**
|
||||
* Gets the anchor positions of the Joint in world
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace box2d
|
||||
data = 0;
|
||||
}
|
||||
|
||||
int Shape::getType() const
|
||||
Shape::Type Shape::getType() const
|
||||
{
|
||||
switch(shape->GetType())
|
||||
{
|
||||
@@ -59,7 +59,7 @@ namespace box2d
|
||||
case e_polygonShape:
|
||||
return SHAPE_POLYGON;
|
||||
default:
|
||||
return -1;
|
||||
return SHAPE_INVALID;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace box2d
|
||||
* Gets the type of Shape. Useful for
|
||||
* debug drawing.
|
||||
**/
|
||||
int getType() const;
|
||||
Type getType() const;
|
||||
|
||||
/**
|
||||
* Sets the friction of the Shape.
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
// LOVE
|
||||
#include "wrap_Joint.h"
|
||||
#include <common/StringMap.h>
|
||||
|
||||
namespace love
|
||||
{
|
||||
@@ -35,7 +36,9 @@ namespace box2d
|
||||
int w_Joint_getType(lua_State * L)
|
||||
{
|
||||
Joint * t = luax_checkjoint(L, 1);
|
||||
lua_pushinteger(L, t->getType());
|
||||
const char * type = "";
|
||||
Joint::getConstant(t->getType(), type);
|
||||
lua_pushstring(L, type);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -236,20 +236,6 @@ namespace box2d
|
||||
0
|
||||
};
|
||||
|
||||
// List of constants.
|
||||
static const Constant constants[] = {
|
||||
{ "shape_circle", Shape::SHAPE_CIRCLE },
|
||||
{ "shape_polygon", Shape::SHAPE_POLYGON },
|
||||
|
||||
{ "joint_distance", Joint::JOINT_DISTANCE },
|
||||
{ "joint_revolute", Joint::JOINT_REVOLUTE },
|
||||
{ "joint_prismatic", Joint::JOINT_PRISMATIC },
|
||||
{ "joint_mouse", Joint::JOINT_MOUSE },
|
||||
{ "joint_pulley", Joint::JOINT_PULLEY },
|
||||
{ "joint_gear", Joint::JOINT_GEAR },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
int luaopen_love_physics(lua_State * L)
|
||||
{
|
||||
if(instance == 0)
|
||||
@@ -270,7 +256,6 @@ namespace box2d
|
||||
w.flags = MODULE_T;
|
||||
w.functions = functions;
|
||||
w.types = types;
|
||||
w.constants = constants;
|
||||
|
||||
return luax_register_module(L, w);
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
**/
|
||||
|
||||
#include "wrap_Shape.h"
|
||||
#include <common/StringMap.h>
|
||||
|
||||
namespace love
|
||||
{
|
||||
@@ -34,7 +35,9 @@ namespace box2d
|
||||
int w_Shape_getType(lua_State * L)
|
||||
{
|
||||
Shape * t = luax_checkshape(L, 1);
|
||||
lua_pushinteger(L, t->getType());
|
||||
const char * type = "";
|
||||
Shape::getConstant(t->getType(), type);
|
||||
lua_pushstring(L, type);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user