Browse Source

Merge pull request #970 from JimMarlowe/JM-HAPTIC-954

Add joystick cursor control
JoshEngebretson 9 years ago
parent
commit
5bcb84c3b7
2 changed files with 15 additions and 0 deletions
  1. 13 0
      Source/Atomic/Input/Input.cpp
  2. 2 0
      Source/Atomic/Input/Input.h

+ 13 - 0
Source/Atomic/Input/Input.cpp

@@ -1822,6 +1822,19 @@ void Input::JoystickRumble(unsigned int id, float strength, unsigned int length)
     if (jss)
         jss->DoRumble( strength, length);
 }
+
+void Input::JoystickSimulateMouseMove(int xpos, int ypos) /// moves the on screen cursor
+{
+    IntVector2 position(xpos,ypos);
+    SetMousePosition(position);
+}
+
+void Input::JoystickSimulateMouseButton(int button) /// simulated mouse press down & up
+{
+    SetMouseButton( button, true );
+    SetMouseButton( button, false );
+}
+
 // ATOMIC END
 
 void Input::SendInputFocusEvent()

+ 2 - 0
Source/Atomic/Input/Input.h

@@ -326,6 +326,8 @@ public:
     
     bool GetJoystickRumble(unsigned int id);  /// return if rumble is supported on game controller
     void JoystickRumble(unsigned int id, float strength, unsigned int length); /// produce rumble
+    void JoystickSimulateMouseMove(int xpos, int ypos); /// moves the on screen cursor
+    void JoystickSimulateMouseButton(int button); /// simulated mouse press down & up
 
 // ATOMIC END