Browse Source

Script bindings for new input functions.

Lasse Öörni 9 years ago
parent
commit
886e48ab8a

+ 2 - 0
Source/Urho3D/AngelScript/InputAPI.cpp

@@ -550,6 +550,7 @@ static void RegisterInput(asIScriptEngine* engine)
     engine->RegisterObjectMethod("Input", "uint LoadGestures(VectorBuffer&)", asFUNCTION(InputLoadGesturesVectorBuffer), asCALL_CDECL_OBJLAST);
     engine->RegisterObjectMethod("Input", "bool RemoveGesture(uint)", asMETHOD(Input, RemoveGesture), asCALL_THISCALL);
     engine->RegisterObjectMethod("Input", "void RemoveAllGestures()", asMETHOD(Input, RemoveAllGestures), asCALL_THISCALL);
+    engine->RegisterObjectMethod("Input", "void CenterMousePosition()", asMETHOD(Input, CenterMousePosition), asCALL_THISCALL);
     engine->RegisterObjectMethod("Input", "int GetKeyFromName(const String&in) const", asMETHOD(Input, GetKeyFromName), asCALL_THISCALL);
     engine->RegisterObjectMethod("Input", "int GetKeyFromScancode(int) const", asMETHOD(Input, GetKeyFromScancode), asCALL_THISCALL);
     engine->RegisterObjectMethod("Input", "String GetKeyName(int) const", asMETHOD(Input, GetKeyName), asCALL_THISCALL);
@@ -587,6 +588,7 @@ static void RegisterInput(asIScriptEngine* engine)
     engine->RegisterObjectMethod("Input", "bool get_qualifierDown(int) const", asMETHOD(Input, GetQualifierDown), asCALL_THISCALL);
     engine->RegisterObjectMethod("Input", "bool get_qualifierPress(int) const", asMETHOD(Input, GetQualifierPress), asCALL_THISCALL);
     engine->RegisterObjectMethod("Input", "int get_qualifiers() const", asMETHOD(Input, GetQualifiers), asCALL_THISCALL);
+    engine->RegisterObjectMethod("Input", "void set_mousePosition(const IntVector2&in)", asMETHOD(Input, SetMousePosition), asCALL_THISCALL);
     engine->RegisterObjectMethod("Input", "IntVector2 get_mousePosition() const", asMETHOD(Input, GetMousePosition), asCALL_THISCALL);
     engine->RegisterObjectMethod("Input", "const IntVector2& get_mouseMove() const", asMETHOD(Input, GetMouseMove), asCALL_THISCALL);
     engine->RegisterObjectMethod("Input", "int get_mouseMoveX() const", asMETHOD(Input, GetMouseMoveX), asCALL_THISCALL);

+ 4 - 5
Source/Urho3D/Input/Input.h

@@ -212,6 +212,10 @@ public:
     bool RemoveGesture(unsigned gestureID);
     /// Remove all in-memory gestures.
     void RemoveAllGestures();
+    /// Set the mouse cursor position.
+    void SetMousePosition(const IntVector2& position);
+    /// Center the mouse position.
+    void CenterMousePosition();
 
     /// Return keycode from key name.
     int GetKeyFromName(const String& name) const;
@@ -297,11 +301,6 @@ public:
     /// Return whether application window is minimized.
     bool IsMinimized() const;
 
-    /// Set the mouse cursor position.
-    void SetMousePosition(const IntVector2& position);
-    /// Center the mouse position.
-    void CenterMousePosition();
-
 private:
     /// Initialize when screen mode initially set.
     void Initialize();

+ 3 - 1
Source/Urho3D/LuaScript/pkgs/Input/Input.pkg

@@ -64,6 +64,8 @@ class Input : public Object
     tolua_outside unsigned InputLoadGestures @ LoadGestures(const String fileName);
     bool RemoveGesture(unsigned gestureID);
     void RemoveAllGestures();
+    void SetMousePosition(const IntVector2& position);
+    void CenterMousePosition();
 
     int GetKeyFromName(const String name) const;
     int GetKeyFromScancode(int scancode) const;
@@ -103,7 +105,7 @@ class Input : public Object
     bool IsMinimized() const;
 
     tolua_readonly tolua_property__get_set int qualifiers;
-    tolua_readonly tolua_property__get_set IntVector2 mousePosition;
+    tolua_property__get_set IntVector2 mousePosition;
     tolua_readonly tolua_property__get_set IntVector2& mouseMove;
     tolua_readonly tolua_property__get_set int mouseMoveX;
     tolua_readonly tolua_property__get_set int mouseMoveY;