Browse Source

Add Lua and AngelScript binding.

aster2013 11 years ago
parent
commit
fc0e65a8d9

+ 1 - 1
Bin/Data/LuaScripts/28_Urho2DPhysicsRope.lua

@@ -91,7 +91,7 @@ function CreateScene()
 
 
         local joint = node:CreateComponent("ConstraintRevolute2D")
         local joint = node:CreateComponent("ConstraintRevolute2D")
         joint.otherBody = prevBody
         joint.otherBody = prevBody
-        joint.anchorPoint = Vector2(i, y)
+        joint.anchor = Vector2(i, y)
         joint.collideConnected = false
         joint.collideConnected = false
 
 
         prevBody = body
         prevBody = body

+ 1 - 1
Bin/Data/Scripts/28_Urho2DPhysicsRope.as

@@ -99,7 +99,7 @@ void CreateScene()
 
 
         ConstraintRevolute2D@ joint = node.CreateComponent("ConstraintRevolute2D");
         ConstraintRevolute2D@ joint = node.CreateComponent("ConstraintRevolute2D");
         joint.otherBody = prevBody;
         joint.otherBody = prevBody;
-        joint.anchorPoint = Vector2(i, y);
+        joint.anchor = Vector2(i, y);
         joint.collideConnected = false;
         joint.collideConnected = false;
 
 
         prevBody = body;
         prevBody = body;

+ 3 - 3
Source/Engine/LuaScript/pkgs/Urho2D/ConstraintFriction2D.pkg

@@ -2,15 +2,15 @@ $#include "ConstraintFriction2D.h"
 
 
 class ConstraintFriction2D : Constraint2D
 class ConstraintFriction2D : Constraint2D
 {
 {
-    void SetAnchorPoint(const Vector2& anchor);
+    void SetAnchor(const Vector2& anchor);
     void SetMaxForce(float maxForce);
     void SetMaxForce(float maxForce);
     void SetMaxTorque(float maxTorque);
     void SetMaxTorque(float maxTorque);
 
 
-    const Vector2& GetAnchorPoint() const;
+    const Vector2& GetAnchor() const;
     float GetMaxForce() const;
     float GetMaxForce() const;
     float GetMaxTorque() const;
     float GetMaxTorque() const;
 
 
-    tolua_property__get_set Vector2& anchorPoint;
+    tolua_property__get_set Vector2& anchor;
     tolua_property__get_set float maxForce;
     tolua_property__get_set float maxForce;
     tolua_property__get_set float maxTorque;
     tolua_property__get_set float maxTorque;
 };
 };

+ 16 - 0
Source/Engine/LuaScript/pkgs/Urho2D/ConstraintGear2D.pkg

@@ -0,0 +1,16 @@
+$#include "ConstraintGear2D.h"
+
+class ConstraintGear2D : Constraint2D
+{
+    void SetOwnerConstraint(Constraint2D* constraint);
+    void SetOtherConstraint(Constraint2D* constraint);
+    void SetRatio(float ratio);
+
+    Constraint2D* GetOwnerConstraint() const;
+    Constraint2D* GetOtherConstraint() const;
+    float GetRatio() const;
+    
+    tolua_property__get_set Constraint2D* ownerConstraint;
+    tolua_property__get_set Constraint2D* otherConstraint;
+    tolua_property__get_set float ratio;
+};

+ 16 - 0
Source/Engine/LuaScript/pkgs/Urho2D/ConstraintMotor2D.pkg

@@ -0,0 +1,16 @@
+$#include "ConstraintMotor2D.h"
+
+class ConstraintMotor2D : Constraint2D
+{
+    void SetOwnerBodyAnchor(const Vector2& anchor);
+    void SetOtherBodyAnchor(const Vector2& anchor);
+    void SetMaxLength(float maxLength);
+
+    const Vector2& GetOwnerBodyAnchor() const;
+    const Vector2& GetOtherBodyAnchor() const;
+    float GetMaxLength() const;
+
+    tolua_property__get_set Vector2& ownerBodyAnchor;
+    tolua_property__get_set Vector2& otherBodyAnchor;
+    tolua_property__get_set float maxLength;
+};

+ 19 - 0
Source/Engine/LuaScript/pkgs/Urho2D/ConstraintMouse2D.pkg

@@ -0,0 +1,19 @@
+$#include "ConstraintMouse2D.h"
+class ConstraintMouse2D : Constraint2D
+{
+    void SetTarget(const Vector2& target);
+    void SetMaxForce(float maxForce);
+    void SetFrequencyHz(float frequencyHz);
+    void SetDampingRatio(float dampingRatio);
+
+    const Vector2& GetTarget() const;
+    float GetMaxForce() const;
+    float GetFrequencyHz() const;
+    float GetDampingRatio() const;
+
+
+    tolua_property__get_set Vector2& target;
+    tolua_property__get_set float maxForce;
+    tolua_property__get_set float frequencyHz;
+    tolua_property__get_set float dampingRatio;
+};

+ 31 - 0
Source/Engine/LuaScript/pkgs/Urho2D/ConstraintPrismatic2D.pkg

@@ -0,0 +1,31 @@
+$#include "ConstraintPrismatic2D.h"
+
+class ConstraintPrismatic2D : Constraint2D
+{
+    void SetAnchor(const Vector2& anchor);
+    void SetAxis(const Vector2& axis);
+    void SetEnableLimit(bool enableLimit);
+    void SetLowerTranslation(float lowerTranslation);
+    void SetUpperTranslation(float upperTranslation);
+    void SetEnableMotor(bool enableMotor);
+    void SetMaxMotorForce(float maxMotorForce);
+    void SetMotorSpeed(float motorSpeed);
+
+    const Vector2& GetAnchor() const;
+    const Vector2& GetAxis() const;
+    bool GetEnableLimit() const;
+    float GetLowerTranslation() const;
+    float GetUpperTranslation() const;
+    bool GetEnableMotor() const;
+    float GetMaxMotorForce() const;
+    float GetMotorSpeed() const;
+
+    tolua_property__get_set Vector2& anchor;
+    tolua_property__get_set Vector2& axis;
+    tolua_property__get_set bool enableLimit;
+    tolua_property__get_set float lowerTranslation;
+    tolua_property__get_set float upperTranslation;
+    tolua_property__get_set bool enableMotor;
+    tolua_property__get_set float maxMotorForce;
+    tolua_property__get_set float motorSpeed;
+};

+ 3 - 3
Source/Engine/LuaScript/pkgs/Urho2D/ConstraintRevolute2D.pkg

@@ -2,7 +2,7 @@ $#include "ConstraintRevolute2D.h"
 
 
 class ConstraintRevolute2D : Constraint2D
 class ConstraintRevolute2D : Constraint2D
 {
 {
-    void SetAnchorPoint(const Vector2& anchor);
+    void SetAnchor(const Vector2& anchor);
     void SetEnableLimit(bool enableLimit);
     void SetEnableLimit(bool enableLimit);
     void SetLowerAngle(float lowerAngle);
     void SetLowerAngle(float lowerAngle);
     void SetUpperAngle(float upperAngle);
     void SetUpperAngle(float upperAngle);
@@ -10,7 +10,7 @@ class ConstraintRevolute2D : Constraint2D
     void SetMotorSpeed(float motorSpeed);
     void SetMotorSpeed(float motorSpeed);
     void SetMaxMotorTorque(float maxMotorTorque);
     void SetMaxMotorTorque(float maxMotorTorque);
 
 
-    const Vector2& GetAnchorPoint() const;
+    const Vector2& GetAnchor() const;
     bool GetEnableLimit() const;
     bool GetEnableLimit() const;
     float GetLowerAngle() const;
     float GetLowerAngle() const;
     float GetUpperAngle() const;
     float GetUpperAngle() const;
@@ -18,7 +18,7 @@ class ConstraintRevolute2D : Constraint2D
     float GetMotorSpeed() const;
     float GetMotorSpeed() const;
     float GetMaxMotorTorque() const;
     float GetMaxMotorTorque() const;
 
 
-    tolua_property__get_set Vector2& anchorPoint;
+    tolua_property__get_set Vector2& anchor;
     tolua_property__get_set bool enableLimit;
     tolua_property__get_set bool enableLimit;
     tolua_property__get_set float lowerAngle;
     tolua_property__get_set float lowerAngle;
     tolua_property__get_set float upperAngle;
     tolua_property__get_set float upperAngle;

+ 16 - 0
Source/Engine/LuaScript/pkgs/Urho2D/ConstraintWeld2D.pkg

@@ -0,0 +1,16 @@
+$#include "ConstraintWeld2D.h"
+
+class  ConstraintWeld2D : Constraint2D
+{
+    void SetAnchor(const Vector2& anchor);
+    void SetFrequencyHz(float frequencyHz);
+    void SetDampingRatio(float dampingRatio);
+
+    const Vector2& GetAnchor() const;
+    float GetFrequencyHz() const;
+    float GetDampingRatio() const;
+
+    tolua_property__get_set Vector2& anchor;
+    tolua_property__get_set float frequencyHz;
+    tolua_property__get_set float dampingRatio;
+};

+ 28 - 0
Source/Engine/LuaScript/pkgs/Urho2D/ConstraintWheel2D.pkg

@@ -0,0 +1,28 @@
+$#include "ConstraintWheel2D.h"
+
+class ConstraintWheel2D : Constraint2D
+{
+    void SetAnchor(const Vector2& anchor);
+    void SetAxis(const Vector2& axis);
+    void SetEnableMotor(bool enableMotor);
+    void SetMaxMotorTorque(float maxMotorTorque);
+    void SetMotorSpeed(float motorSpeed);
+    void SetFrequencyHz(float frequencyHz);
+    void SetDampingRatio(float dampingRatio);
+
+    const Vector2& GetAnchor() const;
+    const Vector2& GetAxis() const;
+    bool GetEnableMotor() const;
+    float GetMaxMotorTorque() const;
+    float GetMotorSpeed() const;
+    float GetFrequencyHz() const;
+    float GetDampingRatio() const;
+
+    tolua_property__get_set Vector2& anchor;
+    tolua_property__get_set Vector2& axis;
+    tolua_property__get_set bool enableMotor;
+    tolua_property__get_set float maxMotorTorque;
+    tolua_property__get_set float motorSpeed;
+    tolua_property__get_set float frequencyHz;
+    tolua_property__get_set float dampingRatio;
+};

+ 6 - 0
Source/Engine/LuaScript/pkgs/Urho2DLuaAPI.pkg

@@ -20,9 +20,15 @@ $pfile "Urho2D/CollisionPolygon2D.pkg"
 $pfile "Urho2D/Constraint2D.pkg"
 $pfile "Urho2D/Constraint2D.pkg"
 $pfile "Urho2D/ConstraintDistance2D.pkg"
 $pfile "Urho2D/ConstraintDistance2D.pkg"
 $pfile "Urho2D/ConstraintFriction2D.pkg"
 $pfile "Urho2D/ConstraintFriction2D.pkg"
+$pfile "Urho2D/ConstraintGear2D.pkg"
+$pfile "Urho2D/ConstraintMotor2D.pkg"
+$pfile "Urho2D/ConstraintMouse2D.pkg"
+$pfile "Urho2D/ConstraintPrismatic2D.pkg"
 $pfile "Urho2D/ConstraintPulley2D.pkg"
 $pfile "Urho2D/ConstraintPulley2D.pkg"
 $pfile "Urho2D/ConstraintRevolute2D.pkg"
 $pfile "Urho2D/ConstraintRevolute2D.pkg"
 $pfile "Urho2D/ConstraintRope2D.pkg"
 $pfile "Urho2D/ConstraintRope2D.pkg"
+$pfile "Urho2D/ConstraintWeld2D.pkg"
+$pfile "Urho2D/ConstraintWheel2D.pkg"
 
 
 $using namespace Urho3D;
 $using namespace Urho3D;
 $#pragma warning(disable:4800)
 $#pragma warning(disable:4800)

+ 103 - 6
Source/Engine/Script/Urho2DAPI.cpp

@@ -11,7 +11,7 @@
 // The above copyright notice and this permission notice shall be included in
 // The above copyright notice and this permission notice shall be included in
 // all copies or substantial portions of the Software.
 // all copies or substantial portions of the Software.
 //
 //
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRNTY OF ANY KIND, EXPRESS OR
 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
@@ -33,8 +33,14 @@
 #include "Constraint2D.h"
 #include "Constraint2D.h"
 #include "ConstraintDistance2D.h"
 #include "ConstraintDistance2D.h"
 #include "ConstraintFriction2D.h"
 #include "ConstraintFriction2D.h"
+#include "ConstraintGear2D.h"
+#include "ConstraintMotor2D.h"
+#include "ConstraintMouse2D.h"
+#include "ConstraintPrismatic2D.h"
 #include "ConstraintPulley2D.h"
 #include "ConstraintPulley2D.h"
 #include "ConstraintRevolute2D.h"
 #include "ConstraintRevolute2D.h"
+#include "ConstraintWeld2D.h"
+#include "ConstraintWheel2D.h"
 #include "ConstraintRope2D.h"
 #include "ConstraintRope2D.h"
 #include "Drawable2D.h"
 #include "Drawable2D.h"
 #include "ParticleEmitter2D.h"
 #include "ParticleEmitter2D.h"
@@ -434,14 +440,70 @@ static void RegisterConstraintDistance2D(asIScriptEngine* engine)
 static void RegisterConstraintFriction2D(asIScriptEngine* engine)
 static void RegisterConstraintFriction2D(asIScriptEngine* engine)
 {
 {
     RegisterConstraint2D<ConstraintFriction2D>(engine, "ConstraintFriction2D");
     RegisterConstraint2D<ConstraintFriction2D>(engine, "ConstraintFriction2D");
-    engine->RegisterObjectMethod("ConstraintFriction2D", "void set_anchorPoint(const Vector2&)", asMETHOD(ConstraintFriction2D, SetAnchorPoint), asCALL_THISCALL);
-    engine->RegisterObjectMethod("ConstraintFriction2D", "const Vector2& get_anchorPoint() const", asMETHOD(ConstraintFriction2D, GetAnchorPoint), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintFriction2D", "void set_anchor(const Vector2&)", asMETHOD(ConstraintFriction2D, SetAnchor), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintFriction2D", "const Vector2& get_anchor() const", asMETHOD(ConstraintFriction2D, GetAnchor), asCALL_THISCALL);
     engine->RegisterObjectMethod("ConstraintFriction2D", "void set_maxForce(float)", asMETHOD(ConstraintFriction2D, SetMaxForce), asCALL_THISCALL);
     engine->RegisterObjectMethod("ConstraintFriction2D", "void set_maxForce(float)", asMETHOD(ConstraintFriction2D, SetMaxForce), asCALL_THISCALL);
     engine->RegisterObjectMethod("ConstraintFriction2D", "float get_maxForce() const", asMETHOD(ConstraintFriction2D, GetMaxForce), asCALL_THISCALL);
     engine->RegisterObjectMethod("ConstraintFriction2D", "float get_maxForce() const", asMETHOD(ConstraintFriction2D, GetMaxForce), asCALL_THISCALL);
     engine->RegisterObjectMethod("ConstraintFriction2D", "void set_maxTorque(float)", asMETHOD(ConstraintFriction2D, SetMaxTorque), asCALL_THISCALL);
     engine->RegisterObjectMethod("ConstraintFriction2D", "void set_maxTorque(float)", asMETHOD(ConstraintFriction2D, SetMaxTorque), asCALL_THISCALL);
     engine->RegisterObjectMethod("ConstraintFriction2D", "float get_maxTorque() const", asMETHOD(ConstraintFriction2D, GetMaxTorque), asCALL_THISCALL);
     engine->RegisterObjectMethod("ConstraintFriction2D", "float get_maxTorque() const", asMETHOD(ConstraintFriction2D, GetMaxTorque), asCALL_THISCALL);
 }
 }
 
 
+static void RegisterConstraintGear2D(asIScriptEngine* engine)
+{
+    RegisterConstraint2D<ConstraintGear2D>(engine, "ConstraintGear2D");
+    engine->RegisterObjectMethod("ConstraintGear2D", "void set_ownerConstraint(Constraint2D@+)", asMETHOD(ConstraintGear2D, SetOwnerConstraint), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintGear2D", "Constraint2D@+ get_ownerConstraint() const", asMETHOD(ConstraintGear2D, GetOwnerConstraint), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintGear2D", "void set_otherConstraint(Constraint2D@+)", asMETHOD(ConstraintGear2D, SetOtherConstraint), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintGear2D", "Constraint2D@+ get_otherConstraint() const", asMETHOD(ConstraintGear2D, GetOtherConstraint), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintGear2D", "void set_ratio(float)", asMETHOD(ConstraintGear2D, SetRatio), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintGear2D", "float get_ratio() const", asMETHOD(ConstraintGear2D, GetRatio), asCALL_THISCALL);
+}
+
+static void RegisterConstraintMotor2D(asIScriptEngine* engine)
+{
+    RegisterConstraint2D<ConstraintMotor2D>(engine, "ConstraintMotor2D");
+    engine->RegisterObjectMethod("ConstraintMotor2D", "void set_ownerBodyAnchor(const Vector2&)", asMETHOD(ConstraintMotor2D, SetOwnerBodyAnchor), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintMotor2D", "const Vector2& get_ownerBodyAnchor() const", asMETHOD(ConstraintMotor2D, GetOwnerBodyAnchor), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintMotor2D", "void set_otherBodyAnchor(const Vector2&)", asMETHOD(ConstraintMotor2D, SetOtherBodyAnchor), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintMotor2D", "const Vector2& get_otherBodyAnchor() const", asMETHOD(ConstraintMotor2D, GetOtherBodyAnchor), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintMotor2D", "void set_maxLength(float)", asMETHOD(ConstraintMotor2D, SetMaxLength), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintMotor2D", "float get_maxLength() const", asMETHOD(ConstraintMotor2D, GetMaxLength), asCALL_THISCALL);
+}
+
+static void RegisterConstraintMouse2D(asIScriptEngine* engine)
+{
+    RegisterConstraint2D<ConstraintMouse2D>(engine, "ConstraintMouse2D");
+    engine->RegisterObjectMethod("ConstraintMouse2D", "void set_target(const Vector2&)", asMETHOD(ConstraintMouse2D, SetTarget), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintMouse2D", "const Vector2& get_target() const", asMETHOD(ConstraintMouse2D, GetTarget), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintMouse2D", "void set_maxForce(float)", asMETHOD(ConstraintMouse2D, SetMaxForce), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintMouse2D", "float get_maxForce() const", asMETHOD(ConstraintMouse2D, GetMaxForce), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintMouse2D", "void set_frequencyHz(float)", asMETHOD(ConstraintMouse2D, SetFrequencyHz), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintMouse2D", "float get_frequencyHz() const", asMETHOD(ConstraintMouse2D, GetFrequencyHz), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintMouse2D", "void set_dampingRatio(float)", asMETHOD(ConstraintMouse2D, SetDampingRatio), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintMouse2D", "float get_dampingRatio() const", asMETHOD(ConstraintMouse2D, GetDampingRatio), asCALL_THISCALL);
+}
+
+static void RegisterConstraintPrismatic2D(asIScriptEngine* engine)
+{
+    RegisterConstraint2D<ConstraintPrismatic2D>(engine, "ConstraintPrismatic2D");
+    engine->RegisterObjectMethod("ConstraintPrismatic2D", "void set_anchor(const Vector2&)", asMETHOD(ConstraintPrismatic2D, SetAnchor), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintPrismatic2D", "const Vector2& get_anchor() const", asMETHOD(ConstraintPrismatic2D, GetAnchor), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintPrismatic2D", "void set_axis(const Vector2&)", asMETHOD(ConstraintPrismatic2D, SetAxis), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintPrismatic2D", "const Vector2& get_axis() const", asMETHOD(ConstraintPrismatic2D, GetAxis), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintPrismatic2D", "void set_enableLimit(bool)", asMETHOD(ConstraintPrismatic2D, SetEnableLimit), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintPrismatic2D", "bool get_enableLimit() const", asMETHOD(ConstraintPrismatic2D, GetEnableLimit), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintPrismatic2D", "void set_lowerTranslation(float)", asMETHOD(ConstraintPrismatic2D, SetLowerTranslation), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintPrismatic2D", "float get_lowerTranslation() const", asMETHOD(ConstraintPrismatic2D, GetLowerTranslation), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintPrismatic2D", "void set_upperTranslation(float)", asMETHOD(ConstraintPrismatic2D, SetUpperTranslation), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintPrismatic2D", "float get_upperTranslation() const", asMETHOD(ConstraintPrismatic2D, GetUpperTranslation), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintPrismatic2D", "void set_enableMotor(bool)", asMETHOD(ConstraintPrismatic2D, SetEnableMotor), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintPrismatic2D", "bool get_enableMotor() const", asMETHOD(ConstraintPrismatic2D, GetEnableMotor), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintPrismatic2D", "void set_maxMotorForce(float)", asMETHOD(ConstraintPrismatic2D, SetMaxMotorForce), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintPrismatic2D", "float get_maxMotorForce() const", asMETHOD(ConstraintPrismatic2D, GetMaxMotorForce), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintPrismatic2D", "void set_motorSpeed(float)", asMETHOD(ConstraintPrismatic2D, SetMotorSpeed), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintPrismatic2D", "float get_motorSpeed() const", asMETHOD(ConstraintPrismatic2D, GetMotorSpeed), asCALL_THISCALL);
+}
+
 static void RegisterConstraintPulley2D(asIScriptEngine* engine)
 static void RegisterConstraintPulley2D(asIScriptEngine* engine)
 {
 {
     RegisterConstraint2D<ConstraintPulley2D>(engine, "ConstraintPulley2D");
     RegisterConstraint2D<ConstraintPulley2D>(engine, "ConstraintPulley2D");
@@ -453,7 +515,6 @@ static void RegisterConstraintPulley2D(asIScriptEngine* engine)
     engine->RegisterObjectMethod("ConstraintPulley2D", "const Vector2& get_ownerBodyAnchor() const", asMETHOD(ConstraintPulley2D, GetOwnerBodyAnchor), asCALL_THISCALL);
     engine->RegisterObjectMethod("ConstraintPulley2D", "const Vector2& get_ownerBodyAnchor() const", asMETHOD(ConstraintPulley2D, GetOwnerBodyAnchor), asCALL_THISCALL);
     engine->RegisterObjectMethod("ConstraintPulley2D", "void set_otherBodyAnchor(const Vector2&)", asMETHOD(ConstraintPulley2D, SetOtherBodyAnchor), asCALL_THISCALL);
     engine->RegisterObjectMethod("ConstraintPulley2D", "void set_otherBodyAnchor(const Vector2&)", asMETHOD(ConstraintPulley2D, SetOtherBodyAnchor), asCALL_THISCALL);
     engine->RegisterObjectMethod("ConstraintPulley2D", "const Vector2& get_otherBodyAnchor() const", asMETHOD(ConstraintPulley2D, GetOtherBodyAnchor), asCALL_THISCALL);
     engine->RegisterObjectMethod("ConstraintPulley2D", "const Vector2& get_otherBodyAnchor() const", asMETHOD(ConstraintPulley2D, GetOtherBodyAnchor), asCALL_THISCALL);
-
     engine->RegisterObjectMethod("ConstraintPulley2D", "void set_ratio(float)", asMETHOD(ConstraintPulley2D, SetRatio), asCALL_THISCALL);
     engine->RegisterObjectMethod("ConstraintPulley2D", "void set_ratio(float)", asMETHOD(ConstraintPulley2D, SetRatio), asCALL_THISCALL);
     engine->RegisterObjectMethod("ConstraintPulley2D", "float get_ratio() const", asMETHOD(ConstraintPulley2D, GetRatio), asCALL_THISCALL);
     engine->RegisterObjectMethod("ConstraintPulley2D", "float get_ratio() const", asMETHOD(ConstraintPulley2D, GetRatio), asCALL_THISCALL);
 }
 }
@@ -461,8 +522,8 @@ static void RegisterConstraintPulley2D(asIScriptEngine* engine)
 static void RegisterConstraintRevolute2D(asIScriptEngine* engine)
 static void RegisterConstraintRevolute2D(asIScriptEngine* engine)
 {
 {
     RegisterConstraint2D<ConstraintRevolute2D>(engine, "ConstraintRevolute2D");
     RegisterConstraint2D<ConstraintRevolute2D>(engine, "ConstraintRevolute2D");
-    engine->RegisterObjectMethod("ConstraintRevolute2D", "void set_anchorPoint(const Vector2&)", asMETHOD(ConstraintRevolute2D, SetAnchorPoint), asCALL_THISCALL);
-    engine->RegisterObjectMethod("ConstraintRevolute2D", "const Vector2& get_anchorPoint() const", asMETHOD(ConstraintRevolute2D, GetAnchorPoint), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintRevolute2D", "void set_anchor(const Vector2&)", asMETHOD(ConstraintRevolute2D, SetAnchor), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintRevolute2D", "const Vector2& get_anchor() const", asMETHOD(ConstraintRevolute2D, GetAnchor), asCALL_THISCALL);
     engine->RegisterObjectMethod("ConstraintRevolute2D", "void set_enableLimit(bool)", asMETHOD(ConstraintRevolute2D, SetEnableLimit), asCALL_THISCALL);
     engine->RegisterObjectMethod("ConstraintRevolute2D", "void set_enableLimit(bool)", asMETHOD(ConstraintRevolute2D, SetEnableLimit), asCALL_THISCALL);
     engine->RegisterObjectMethod("ConstraintRevolute2D", "bool get_enableLimit() const", asMETHOD(ConstraintRevolute2D, GetEnableLimit), asCALL_THISCALL);
     engine->RegisterObjectMethod("ConstraintRevolute2D", "bool get_enableLimit() const", asMETHOD(ConstraintRevolute2D, GetEnableLimit), asCALL_THISCALL);
     engine->RegisterObjectMethod("ConstraintRevolute2D", "void set_lowerAngle(float)", asMETHOD(ConstraintRevolute2D, SetLowerAngle), asCALL_THISCALL);
     engine->RegisterObjectMethod("ConstraintRevolute2D", "void set_lowerAngle(float)", asMETHOD(ConstraintRevolute2D, SetLowerAngle), asCALL_THISCALL);
@@ -477,6 +538,36 @@ static void RegisterConstraintRevolute2D(asIScriptEngine* engine)
     engine->RegisterObjectMethod("ConstraintRevolute2D", "float get_maxMotorTorque() const", asMETHOD(ConstraintRevolute2D, GetMaxMotorTorque), asCALL_THISCALL);
     engine->RegisterObjectMethod("ConstraintRevolute2D", "float get_maxMotorTorque() const", asMETHOD(ConstraintRevolute2D, GetMaxMotorTorque), asCALL_THISCALL);
 }
 }
 
 
+static void RegisterConstraintWeld2D(asIScriptEngine* engine)
+{
+    RegisterConstraint2D<ConstraintWeld2D>(engine, "ConstraintWeld2D");
+    engine->RegisterObjectMethod("ConstraintWeld2D", "void set_anchor(const Vector2&)", asMETHOD(ConstraintWeld2D, SetAnchor), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintWeld2D", "const Vector2& get_anchor() const", asMETHOD(ConstraintWeld2D, GetAnchor), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintWeld2D", "void set_frequencyHz(float)", asMETHOD(ConstraintWeld2D, SetFrequencyHz), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintWeld2D", "float get_frequencyHz() const", asMETHOD(ConstraintWeld2D, GetFrequencyHz), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintWeld2D", "void set_dampingRatio(float)", asMETHOD(ConstraintWeld2D, SetDampingRatio), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintWeld2D", "float get_dampingRatio() const", asMETHOD(ConstraintWeld2D, GetDampingRatio), asCALL_THISCALL);
+}
+
+static void RegisterConstraintWheel2D(asIScriptEngine* engine)
+{
+    RegisterConstraint2D<ConstraintWheel2D>(engine, "ConstraintWheel2D");
+    engine->RegisterObjectMethod("ConstraintWheel2D", "void set_anchor(const Vector2&)", asMETHOD(ConstraintWheel2D, SetAnchor), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintWheel2D", "const Vector2& get_anchor() const", asMETHOD(ConstraintWheel2D, GetAnchor), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintWheel2D", "void set_axis(const Vector2&)", asMETHOD(ConstraintWheel2D, SetAxis), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintWheel2D", "const Vector2& get_axis() const", asMETHOD(ConstraintWheel2D, GetAxis), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintWheel2D", "void set_enableMotor(bool)", asMETHOD(ConstraintWheel2D, SetEnableMotor), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintWheel2D", "bool get_enableMotor() const", asMETHOD(ConstraintWheel2D, GetEnableMotor), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintWheel2D", "void set_maxMotorTorque(float)", asMETHOD(ConstraintWheel2D, SetMaxMotorTorque), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintWheel2D", "float get_maxMotorTorque() const", asMETHOD(ConstraintWheel2D, GetMaxMotorTorque), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintWheel2D", "void set_motorSpeed(float)", asMETHOD(ConstraintWheel2D, SetMotorSpeed), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintWheel2D", "float get_motorSpeed() const", asMETHOD(ConstraintWheel2D, GetMotorSpeed), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintWheel2D", "void set_frequencyHz(float)", asMETHOD(ConstraintWheel2D, SetFrequencyHz), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintWheel2D", "float get_frequencyHz() const", asMETHOD(ConstraintWheel2D, GetFrequencyHz), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintWheel2D", "void set_dampingRatio(float)", asMETHOD(ConstraintWheel2D, SetDampingRatio), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ConstraintWheel2D", "float get_dampingRatio() const", asMETHOD(ConstraintWheel2D, GetDampingRatio), asCALL_THISCALL);
+}
+
 static void RegisterConstraintRope2D(asIScriptEngine* engine)
 static void RegisterConstraintRope2D(asIScriptEngine* engine)
 {
 {
     RegisterConstraint2D<ConstraintRope2D>(engine, "ConstraintRope2D");
     RegisterConstraint2D<ConstraintRope2D>(engine, "ConstraintRope2D");
@@ -512,8 +603,14 @@ void RegisterUrho2DAPI(asIScriptEngine* engine)
     RegisterConstraint2D(engine);
     RegisterConstraint2D(engine);
     RegisterConstraintDistance2D(engine);
     RegisterConstraintDistance2D(engine);
     RegisterConstraintFriction2D(engine);
     RegisterConstraintFriction2D(engine);
+    RegisterConstraintGear2D(engine);
+    RegisterConstraintMotor2D(engine);
+    RegisterConstraintMouse2D(engine);
+    RegisterConstraintPrismatic2D(engine);
     RegisterConstraintPulley2D(engine);
     RegisterConstraintPulley2D(engine);
     RegisterConstraintRevolute2D(engine);
     RegisterConstraintRevolute2D(engine);
+    RegisterConstraintWeld2D(engine);
+    RegisterConstraintWheel2D(engine);
     RegisterConstraintRope2D(engine);
     RegisterConstraintRope2D(engine);
 }
 }
 
 

+ 1 - 1
Source/Samples/28_Urho2DPhysicsRope/Urho2DPhysicsRope.cpp

@@ -134,7 +134,7 @@ void Urho2DPhysicsRope::CreateScene()
 
 
         ConstraintRevolute2D* joint = node->CreateComponent<ConstraintRevolute2D>();
         ConstraintRevolute2D* joint = node->CreateComponent<ConstraintRevolute2D>();
         joint->SetOtherBody(prevBody);
         joint->SetOtherBody(prevBody);
-        joint->SetAnchorPoint(Vector2(float(i), y));
+        joint->SetAnchor(Vector2(float(i), y));
         joint->SetCollideConnected(false);
         joint->SetCollideConnected(false);
 
 
         prevBody = body;
         prevBody = body;