Browse Source

Virtual DPad JS script is throwing exception #1249

JimMarlowe 9 years ago
parent
commit
3cc3f4d890
2 changed files with 9 additions and 0 deletions
  1. 4 0
      Source/Atomic/Input/Input.cpp
  2. 5 0
      Source/Atomic/Input/Input.h

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

@@ -2758,6 +2758,10 @@ void Input::HandleScreenJoystickTouch(StringHash eventType, VariantMap& eventDat
 }
 }
 
 
 // ATOMIC BEGIN
 // ATOMIC BEGIN
+void Input::BindButton(UIButton* touchButton, int button)
+{
+    touchButton->SetEmulationButton(button);
+}
 
 
 void Input::SimulateButtonDown(int button)
 void Input::SimulateButtonDown(int button)
 {
 {

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

@@ -27,6 +27,7 @@
 #include "../Core/Object.h"
 #include "../Core/Object.h"
 #include "../Container/List.h"
 #include "../Container/List.h"
 #include "../Input/InputEvents.h"
 #include "../Input/InputEvents.h"
+#include "../UI/UIButton.h"
 
 
 // ATOMIC BEGIN
 // ATOMIC BEGIN
 // #include "../UI/Cursor.h"
 // #include "../UI/Cursor.h"
@@ -50,6 +51,7 @@ class Graphics;
 class Serializer;
 class Serializer;
 class UIWidget;
 class UIWidget;
 class XMLFile;
 class XMLFile;
+class UIButton;
 
 
 const IntVector2 MOUSE_POSITION_OFFSCREEN = IntVector2(M_MIN_INT, M_MIN_INT);
 const IntVector2 MOUSE_POSITION_OFFSCREEN = IntVector2(M_MIN_INT, M_MIN_INT);
 
 
@@ -330,6 +332,9 @@ public:
     bool IsMinimized() const;
     bool IsMinimized() const;
 
 
 // ATOMIC BEGIN
 // ATOMIC BEGIN
+    /// Binds UIButton element to the given button
+    void BindButton(UIButton* touchButton, int button);
+
     void SimulateButtonDown(int button);
     void SimulateButtonDown(int button);
     void SimulateButtonUp(int button);
     void SimulateButtonUp(int button);