summaryrefslogtreecommitdiff
path: root/source/modules/asura-box2d
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2019-03-30 21:49:29 +0800
committerchai <chaifix@163.com>2019-03-30 21:49:29 +0800
commit8164adb15b76f537f8b6c78b9992786b61d61cc8 (patch)
tree6e42919e32258a3c495dcec54b0fda3e8e1977d8 /source/modules/asura-box2d
parentc270d033fa04873ee7a8925dbb00cae5edc4555c (diff)
*misc
Diffstat (limited to 'source/modules/asura-box2d')
-rw-r--r--source/modules/asura-box2d/binding/_body.cpp172
-rw-r--r--source/modules/asura-box2d/binding/_world.cpp21
-rw-r--r--source/modules/asura-box2d/body.h65
-rw-r--r--source/modules/asura-box2d/chain_shape.h0
-rw-r--r--source/modules/asura-box2d/circle_shape.h0
-rw-r--r--source/modules/asura-box2d/contact.h0
-rw-r--r--source/modules/asura-box2d/debug_draw.h0
-rw-r--r--source/modules/asura-box2d/distance_joint.h0
-rw-r--r--source/modules/asura-box2d/edge_shape.h0
-rw-r--r--source/modules/asura-box2d/fixture.h0
-rw-r--r--source/modules/asura-box2d/friction_joint.h0
-rw-r--r--source/modules/asura-box2d/gear_joint.h0
-rw-r--r--source/modules/asura-box2d/joint.h0
-rw-r--r--source/modules/asura-box2d/motor_joint.h0
-rw-r--r--source/modules/asura-box2d/mouse_joint.h0
-rw-r--r--source/modules/asura-box2d/polygon_shape.h0
-rw-r--r--source/modules/asura-box2d/prismatic_joint.h0
-rw-r--r--source/modules/asura-box2d/pulley_joint.h0
-rw-r--r--source/modules/asura-box2d/revolute_joint.h0
-rw-r--r--source/modules/asura-box2d/rope_joint.h0
-rw-r--r--source/modules/asura-box2d/shape.h0
-rw-r--r--source/modules/asura-box2d/weld_joint.h0
-rw-r--r--source/modules/asura-box2d/wheel_joint.h0
-rw-r--r--source/modules/asura-box2d/world.h19
24 files changed, 277 insertions, 0 deletions
diff --git a/source/modules/asura-box2d/binding/_body.cpp b/source/modules/asura-box2d/binding/_body.cpp
new file mode 100644
index 0000000..51cc0ab
--- /dev/null
+++ b/source/modules/asura-box2d/binding/_body.cpp
@@ -0,0 +1,172 @@
+#include "../body.h"
+
+using namespace std;
+
+namespace AsuraEngine
+{
+ namespace Physics
+ {
+
+ LUAX_REGISTRY(Body)
+ {
+ LUAX_REGISTER_METHODS(state,
+ { "GetType", _GetType },
+ { "GetX", _GetX },
+ { "GetY", _GetY },
+ { "GetAngle", _GetAngle },
+ { "GetPosition", _GetPosition },
+ { "GetLinearVelocity", _GetLinearVelocity },
+ { "GetWorldCenter", _GetWorldCenter },
+ { "GetLocalCenter", _GetLocalCenter },
+ { "GetAngularVelocity", _GetAngularVelocity },
+ { "GetMass", _GetMass },
+ { "GetInertia", _GetInertia },
+ { "GetMassData", _GetMassData },
+ { "GetAngularDamping", _GetAngularDamping },
+ { "GetLinearDamping", _GetLinearDamping },
+ { "GetGravityScale", _GetGravityScale },
+ { "GetGravityScale", _GetGravityScale }
+ );
+ }
+
+ LUAX_POSTPROCESS(Body)
+ {
+ LUAX_REGISTER_ENUM(state, "EBodyType",
+ { "INVALID", BODY_TYPE_INVALID },
+ { "STATIC", BODY_TYPE_STATIC },
+ { "DYNAMIC", BODY_TYPE_DYNAMIC },
+ { "KINEMATIC", BODY_TYPE_KINEMATIC },
+ { "ENUM", BODY_TYPE_MAX_ENUM }
+ );
+
+ }
+
+ // body:GetType()
+ LUAX_IMPL_METHOD(Body, _GetType)
+ {
+ LUAX_PREPARE(L, Body);
+ return 0;
+ }
+
+ // body:GetX()
+ LUAX_IMPL_METHOD(Body, _GetX)
+ {
+ LUAX_PREPARE(L, Body);
+
+ return 0;
+ }
+
+ // body:GetY()
+ LUAX_IMPL_METHOD(Body, _GetY)
+ {
+ LUAX_PREPARE(L, Body);
+
+ return 0;
+ }
+
+ // body:GetAngle()
+ LUAX_IMPL_METHOD(Body, _GetAngle)
+ {
+ LUAX_PREPARE(L, Body);
+
+ return 0;
+ }
+
+ // body:GetPosition()
+ LUAX_IMPL_METHOD(Body, _GetPosition)
+ {
+ LUAX_PREPARE(L, Body);
+
+ return 0;
+ }
+
+ // body:GetLinearVelocity()
+ LUAX_IMPL_METHOD(Body, _GetLinearVelocity)
+ {
+ LUAX_PREPARE(L, Body);
+
+ return 0;
+ }
+
+ // body:GetWorldCenter()
+ LUAX_IMPL_METHOD(Body, _GetWorldCenter)
+ {
+ LUAX_PREPARE(L, Body);
+
+ return 0;
+ }
+
+ // body:GetLocalCenter()
+ LUAX_IMPL_METHOD(Body, _GetLocalCenter)
+ {
+ LUAX_PREPARE(L, Body);
+
+ return 0;
+ }
+
+ // body:GetAngularVelocity()
+ LUAX_IMPL_METHOD(Body, _GetAngularVelocity)
+ {
+ LUAX_PREPARE(L, Body);
+
+ return 0;
+ }
+
+ // body:GetMass()
+ LUAX_IMPL_METHOD(Body, _GetMass)
+ {
+ LUAX_PREPARE(L, Body);
+
+ return 0;
+ }
+
+ // body:GetInertia()
+ LUAX_IMPL_METHOD(Body, _GetInertia)
+ {
+ LUAX_PREPARE(L, Body);
+
+ return 0;
+ }
+
+ // body:GetMassData()
+ LUAX_IMPL_METHOD(Body, _GetMassData)
+ {
+ LUAX_PREPARE(L, Body);
+
+ return 0;
+ }
+
+ // body:GetAngularDamping()
+ LUAX_IMPL_METHOD(Body, _GetAngularDamping)
+ {
+ LUAX_PREPARE(L, Body);
+
+ return 0;
+ }
+
+ // body:GetLinearDamping()
+ LUAX_IMPL_METHOD(Body, _GetLinearDamping)
+ {
+ LUAX_PREPARE(L, Body);
+
+ return 0;
+ }
+
+ // body:GetGravityScale()
+ LUAX_IMPL_METHOD(Body, _GetGravityScale)
+ {
+ LUAX_PREPARE(L, Body);
+
+ return 0;
+ }
+
+ // body:GetGravityScale()
+ LUAX_IMPL_METHOD(Body, _GetGravityScale)
+ {
+ LUAX_PREPARE(L, Body);
+
+ return 0;
+ }
+
+ }
+}
diff --git a/source/modules/asura-box2d/binding/_world.cpp b/source/modules/asura-box2d/binding/_world.cpp
new file mode 100644
index 0000000..6edd193
--- /dev/null
+++ b/source/modules/asura-box2d/binding/_world.cpp
@@ -0,0 +1,21 @@
+#include "../world.h"
+
+using namespace std;
+
+namespace AsuraEngine
+{
+ namespace Physics
+ {
+
+ LUAX_REGISTRY(World)
+ {
+
+ }
+
+ LUAX_POSTPROCESS(World)
+ {
+
+ }
+
+ }
+}
diff --git a/source/modules/asura-box2d/body.h b/source/modules/asura-box2d/body.h
new file mode 100644
index 0000000..57295c6
--- /dev/null
+++ b/source/modules/asura-box2d/body.h
@@ -0,0 +1,65 @@
+#ifndef __ASURA_BOX2D_BODY_H__
+#define __ASURA_BOX2D_BODY_H__
+
+#include <Box2D/Box2D.h>
+
+#include <asura-utils/scripting/portable.hpp>
+
+namespace AsuraEngine
+{
+ namespace Physics
+ {
+
+ class World;
+
+ enum BodyType
+ {
+ BODY_TYPE_INVALID,
+ BODY_TYPE_STATIC,
+ BODY_TYPE_DYNAMIC,
+ BODY_TYPE_KINEMATIC,
+ BODY_TYPE_MAX_ENUM
+ };
+
+ class Body
+ : public AEScripting::Portable<Body>
+ {
+ public:
+
+ LUAX_DECL_FACTORY(Body);
+
+ b2Body *body;
+
+ private:
+
+ //----------------------------------------------------------------------------//
+
+ LUAX_DECL_ENUM(BodyType);
+
+ LUAX_DECL_METHOD(_GetType);
+ LUAX_DECL_METHOD(_GetX);
+ LUAX_DECL_METHOD(_GetY);
+ LUAX_DECL_METHOD(_GetAngle);
+ LUAX_DECL_METHOD(_GetPosition);
+ LUAX_DECL_METHOD(_GetLinearVelocity);
+ LUAX_DECL_METHOD(_GetWorldCenter);
+ LUAX_DECL_METHOD(_GetLocalCenter);
+ LUAX_DECL_METHOD(_GetAngularVelocity);
+ LUAX_DECL_METHOD(_GetMass);
+ LUAX_DECL_METHOD(_GetInertia);
+ LUAX_DECL_METHOD(_GetMassData);
+ LUAX_DECL_METHOD(_GetAngularDamping);
+ LUAX_DECL_METHOD(_GetLinearDamping);
+ LUAX_DECL_METHOD(_GetGravityScale);
+ LUAX_DECL_METHOD(_GetGravityScale);
+
+ //----------------------------------------------------------------------------//
+
+ World* mWorld;
+
+ };
+
+ }
+}
+
+#endif \ No newline at end of file
diff --git a/source/modules/asura-box2d/chain_shape.h b/source/modules/asura-box2d/chain_shape.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/modules/asura-box2d/chain_shape.h
diff --git a/source/modules/asura-box2d/circle_shape.h b/source/modules/asura-box2d/circle_shape.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/modules/asura-box2d/circle_shape.h
diff --git a/source/modules/asura-box2d/contact.h b/source/modules/asura-box2d/contact.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/modules/asura-box2d/contact.h
diff --git a/source/modules/asura-box2d/debug_draw.h b/source/modules/asura-box2d/debug_draw.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/modules/asura-box2d/debug_draw.h
diff --git a/source/modules/asura-box2d/distance_joint.h b/source/modules/asura-box2d/distance_joint.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/modules/asura-box2d/distance_joint.h
diff --git a/source/modules/asura-box2d/edge_shape.h b/source/modules/asura-box2d/edge_shape.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/modules/asura-box2d/edge_shape.h
diff --git a/source/modules/asura-box2d/fixture.h b/source/modules/asura-box2d/fixture.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/modules/asura-box2d/fixture.h
diff --git a/source/modules/asura-box2d/friction_joint.h b/source/modules/asura-box2d/friction_joint.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/modules/asura-box2d/friction_joint.h
diff --git a/source/modules/asura-box2d/gear_joint.h b/source/modules/asura-box2d/gear_joint.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/modules/asura-box2d/gear_joint.h
diff --git a/source/modules/asura-box2d/joint.h b/source/modules/asura-box2d/joint.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/modules/asura-box2d/joint.h
diff --git a/source/modules/asura-box2d/motor_joint.h b/source/modules/asura-box2d/motor_joint.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/modules/asura-box2d/motor_joint.h
diff --git a/source/modules/asura-box2d/mouse_joint.h b/source/modules/asura-box2d/mouse_joint.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/modules/asura-box2d/mouse_joint.h
diff --git a/source/modules/asura-box2d/polygon_shape.h b/source/modules/asura-box2d/polygon_shape.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/modules/asura-box2d/polygon_shape.h
diff --git a/source/modules/asura-box2d/prismatic_joint.h b/source/modules/asura-box2d/prismatic_joint.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/modules/asura-box2d/prismatic_joint.h
diff --git a/source/modules/asura-box2d/pulley_joint.h b/source/modules/asura-box2d/pulley_joint.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/modules/asura-box2d/pulley_joint.h
diff --git a/source/modules/asura-box2d/revolute_joint.h b/source/modules/asura-box2d/revolute_joint.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/modules/asura-box2d/revolute_joint.h
diff --git a/source/modules/asura-box2d/rope_joint.h b/source/modules/asura-box2d/rope_joint.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/modules/asura-box2d/rope_joint.h
diff --git a/source/modules/asura-box2d/shape.h b/source/modules/asura-box2d/shape.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/modules/asura-box2d/shape.h
diff --git a/source/modules/asura-box2d/weld_joint.h b/source/modules/asura-box2d/weld_joint.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/modules/asura-box2d/weld_joint.h
diff --git a/source/modules/asura-box2d/wheel_joint.h b/source/modules/asura-box2d/wheel_joint.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/modules/asura-box2d/wheel_joint.h
diff --git a/source/modules/asura-box2d/world.h b/source/modules/asura-box2d/world.h
new file mode 100644
index 0000000..0aac0c8
--- /dev/null
+++ b/source/modules/asura-box2d/world.h
@@ -0,0 +1,19 @@
+#ifndef __ASURA_BOX2D_WORLD_H__
+#define __ASURA_BOX2D_WORLD_H__
+
+#include <asura-utils/scripting/portable.hpp>
+
+namespace AsuraEngine
+{
+ namespace Physics
+ {
+
+ class World : public AEScripting::Portable<World>
+ {
+
+ };
+
+ }
+}
+
+#endif \ No newline at end of file