Просмотр исходного кода

Merge pull request #371 from seanpaultaylor/next

Gestures API and support for BlackBerry QNX
Sean Paul Taylor 13 лет назад
Родитель
Сommit
69d7d65c90

+ 23 - 15
gameplay-luagen/gameplay-luagen.doxyfile

@@ -1,4 +1,4 @@
-# Doxyfile 1.8.1
+# Doxyfile 1.8.0
 
 # This file describes the settings to be used by the documentation system
 # doxygen (www.doxygen.org) for a project
@@ -32,7 +32,7 @@ PROJECT_NAME           = gameplay
 # This could be handy for archiving the generated documentation or 
 # if some version control system is used.
 
-PROJECT_NUMBER         = 1.4.0
+PROJECT_NUMBER         = 1.5.0
 
 # Using the PROJECT_BRIEF tag one can provide an optional one line description 
 # for a project that appears at the top of each page and should give viewer 
@@ -564,6 +564,12 @@ MAX_INITIALIZER_LINES  = 30
 
 SHOW_USED_FILES        = NO
 
+# If the sources in your project are distributed over multiple directories 
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy 
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES       = NO
+
 # Set the SHOW_FILES tag to NO to disable the generation of the Files page. 
 # This will remove the Files entry from the Quick Index and from the 
 # Folder Tree View (if specified). The default is YES.
@@ -948,23 +954,20 @@ HTML_COLORSTYLE_GAMMA  = 80
 
 HTML_TIMESTAMP         = YES
 
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, 
+# files or namespaces will be aligned in HTML using tables. If set to 
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS     = YES
+
 # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML 
 # documentation will contain sections that can be hidden and shown after the 
-# page has loaded.
+# page has loaded. For this to work a browser that supports 
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox 
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
 
 HTML_DYNAMIC_SECTIONS  = NO
 
-# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of 
-# entries shown in the various tree structured indices initially; the user 
-# can expand and collapse entries dynamically later on. Doxygen will expand 
-# the tree to such a level that at most the specified number of entries are 
-# visible (unless a fully collapsed tree already exceeds this amount). 
-# So setting the number of entries 1 will produce a full collapsed tree by 
-# default. 0 is a special value representing an infinite number of entries 
-# and will result in a full expanded tree by default.
-
-HTML_INDEX_NUM_ENTRIES = 113
-
 # If the GENERATE_DOCSET tag is set to YES, additional index files 
 # will be generated that can be used as input for Apple's Xcode 3 
 # integrated development environment, introduced with OSX 10.5 (Leopard). 
@@ -1143,6 +1146,11 @@ GENERATE_TREEVIEW      = NO
 
 ENUM_VALUES_PER_LINE   = 4
 
+# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, 
+# and Class Hierarchy pages using a tree view instead of an ordered list.
+
+USE_INLINE_TREES       = NO
+
 # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be 
 # used to set the initial width (in pixels) of the frame in which the tree 
 # is shown.
@@ -1705,7 +1713,7 @@ CALLER_GRAPH           = NO
 
 GRAPHICAL_HIERARCHY    = YES
 
-# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES 
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES 
 # then doxygen will show the dependencies a directory has on other directories 
 # in a graphical way. The dependency relations are determined by the #include 
 # relations between the files in the directories.

+ 7 - 0
gameplay-template/template.cproject

@@ -67,6 +67,7 @@
 									<listOptionValue builtIn="false" value="png14"/>
 									<listOptionValue builtIn="false" value="pps"/>
 									<listOptionValue builtIn="false" value="bps"/>
+									<listOptionValue builtIn="false" value="gestures"/>
 									<listOptionValue builtIn="false" value="OpenAL"/>
 									<listOptionValue builtIn="false" value="asound"/>
 									<listOptionValue builtIn="false" value="gameplay"/>
@@ -151,6 +152,7 @@
 									<listOptionValue builtIn="false" value="png14"/>
 									<listOptionValue builtIn="false" value="pps"/>
 									<listOptionValue builtIn="false" value="bps"/>
+									<listOptionValue builtIn="false" value="gestures"/>
 									<listOptionValue builtIn="false" value="OpenAL"/>
 									<listOptionValue builtIn="false" value="asound"/>
 									<listOptionValue builtIn="false" value="gameplay"/>
@@ -238,6 +240,7 @@
 									<listOptionValue builtIn="false" value="png14"/>
 									<listOptionValue builtIn="false" value="pps"/>
 									<listOptionValue builtIn="false" value="bps"/>
+									<listOptionValue builtIn="false" value="gestures"/>
 									<listOptionValue builtIn="false" value="OpenAL"/>
 									<listOptionValue builtIn="false" value="asound"/>
 									<listOptionValue builtIn="false" value="gameplay"/>
@@ -326,6 +329,7 @@
 									<listOptionValue builtIn="false" value="png14"/>
 									<listOptionValue builtIn="false" value="pps"/>
 									<listOptionValue builtIn="false" value="bps"/>
+									<listOptionValue builtIn="false" value="gestures"/>
 									<listOptionValue builtIn="false" value="OpenAL"/>
 									<listOptionValue builtIn="false" value="asound"/>
 									<listOptionValue builtIn="false" value="gameplay"/>
@@ -411,6 +415,7 @@
 									<listOptionValue builtIn="false" value="png14"/>
 									<listOptionValue builtIn="false" value="pps"/>
 									<listOptionValue builtIn="false" value="bps"/>
+									<listOptionValue builtIn="false" value="gestures"/>
 									<listOptionValue builtIn="false" value="OpenAL"/>
 									<listOptionValue builtIn="false" value="asound"/>
 									<listOptionValue builtIn="false" value="gameplay"/>
@@ -498,6 +503,7 @@
 									<listOptionValue builtIn="false" value="png14"/>
 									<listOptionValue builtIn="false" value="pps"/>
 									<listOptionValue builtIn="false" value="bps"/>
+									<listOptionValue builtIn="false" value="gestures"/>
 									<listOptionValue builtIn="false" value="OpenAL"/>
 									<listOptionValue builtIn="false" value="asound"/>
 									<listOptionValue builtIn="false" value="gameplay"/>
@@ -585,6 +591,7 @@
 									<listOptionValue builtIn="false" value="png14"/>
 									<listOptionValue builtIn="false" value="pps"/>
 									<listOptionValue builtIn="false" value="bps"/>
+									<listOptionValue builtIn="false" value="gestures"/>
 									<listOptionValue builtIn="false" value="OpenAL"/>
 									<listOptionValue builtIn="false" value="asound"/>
 									<listOptionValue builtIn="false" value="gameplay"/>

+ 23 - 15
gameplay.doxyfile

@@ -1,4 +1,4 @@
-# Doxyfile 1.8.1
+# Doxyfile 1.8.0
 
 # This file describes the settings to be used by the documentation system
 # doxygen (www.doxygen.org) for a project
@@ -32,7 +32,7 @@ PROJECT_NAME           = gameplay
 # This could be handy for archiving the generated documentation or 
 # if some version control system is used.
 
-PROJECT_NUMBER         = 1.4.0
+PROJECT_NUMBER         = 1.5.0
 
 # Using the PROJECT_BRIEF tag one can provide an optional one line description 
 # for a project that appears at the top of each page and should give viewer 
@@ -564,6 +564,12 @@ MAX_INITIALIZER_LINES  = 30
 
 SHOW_USED_FILES        = NO
 
+# If the sources in your project are distributed over multiple directories 
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy 
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES       = NO
+
 # Set the SHOW_FILES tag to NO to disable the generation of the Files page. 
 # This will remove the Files entry from the Quick Index and from the 
 # Folder Tree View (if specified). The default is YES.
@@ -948,23 +954,20 @@ HTML_COLORSTYLE_GAMMA  = 80
 
 HTML_TIMESTAMP         = YES
 
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, 
+# files or namespaces will be aligned in HTML using tables. If set to 
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS     = YES
+
 # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML 
 # documentation will contain sections that can be hidden and shown after the 
-# page has loaded.
+# page has loaded. For this to work a browser that supports 
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox 
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
 
 HTML_DYNAMIC_SECTIONS  = NO
 
-# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of 
-# entries shown in the various tree structured indices initially; the user 
-# can expand and collapse entries dynamically later on. Doxygen will expand 
-# the tree to such a level that at most the specified number of entries are 
-# visible (unless a fully collapsed tree already exceeds this amount). 
-# So setting the number of entries 1 will produce a full collapsed tree by 
-# default. 0 is a special value representing an infinite number of entries 
-# and will result in a full expanded tree by default.
-
-HTML_INDEX_NUM_ENTRIES = 100
-
 # If the GENERATE_DOCSET tag is set to YES, additional index files 
 # will be generated that can be used as input for Apple's Xcode 3 
 # integrated development environment, introduced with OSX 10.5 (Leopard). 
@@ -1143,6 +1146,11 @@ GENERATE_TREEVIEW      = NO
 
 ENUM_VALUES_PER_LINE   = 4
 
+# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, 
+# and Class Hierarchy pages using a tree view instead of an ordered list.
+
+USE_INLINE_TREES       = NO
+
 # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be 
 # used to set the initial width (in pixels) of the frame in which the tree 
 # is shown.
@@ -1705,7 +1713,7 @@ CALLER_GRAPH           = NO
 
 GRAPHICAL_HIERARCHY    = YES
 
-# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES 
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES 
 # then doxygen will show the dependencies a directory has on other directories 
 # in a graphical way. The dependency relations are determined by the #include 
 # relations between the files in the directories.

+ 3 - 0
gameplay/android/jni/Android.mk

@@ -53,6 +53,7 @@ LOCAL_SRC_FILES := \
     Game.cpp \
     Gamepad.cpp \
     gameplay-main-android.cpp \
+	Gesture.cpp \
     Image.cpp \
     Joint.cpp \
     Joystick.cpp \
@@ -167,6 +168,8 @@ LOCAL_SRC_FILES := \
     lua/lua_GamepadButtonState.cpp \
     lua/lua_GamepadGamepadEvent.cpp \
     lua/lua_GameState.cpp \
+	lua/lua_Gesture.cpp \
+	lua/lua_GestureGestureEvent.cpp \
     lua/lua_Global.cpp \
     lua/lua_Image.cpp \
     lua/lua_ImageFormat.cpp \

+ 6 - 0
gameplay/gameplay.vcxproj

@@ -114,6 +114,8 @@
     <ClCompile Include="src\lua\lua_GamepadButtonState.cpp" />
     <ClCompile Include="src\lua\lua_GamepadGamepadEvent.cpp" />
     <ClCompile Include="src\lua\lua_GameState.cpp" />
+    <ClCompile Include="src\lua\lua_Gesture.cpp" />
+    <ClCompile Include="src\lua\lua_GestureGestureEvent.cpp" />
     <ClCompile Include="src\lua\lua_Global.cpp" />
     <ClCompile Include="src\lua\lua_Image.cpp" />
     <ClCompile Include="src\lua\lua_ImageFormat.cpp" />
@@ -241,6 +243,7 @@
     <ClCompile Include="src\PhysicsSpringConstraint.cpp" />
     <ClCompile Include="src\Plane.cpp" />
     <ClCompile Include="src\PlatformAndroid.cpp" />
+    <ClCompile Include="src\PlatformLinux.cpp" />
     <ClCompile Include="src\PlatformQNX.cpp" />
     <ClCompile Include="src\PlatformWin32.cpp" />
     <ClCompile Include="src\Properties.cpp" />
@@ -308,6 +311,7 @@
     <ClInclude Include="src\Game.h" />
     <ClInclude Include="src\Gamepad.h" />
     <ClInclude Include="src\gameplay.h" />
+    <ClInclude Include="src\Gesture.h" />
     <ClInclude Include="src\Image.h" />
     <ClInclude Include="src\Joint.h" />
     <ClInclude Include="src\Joystick.h" />
@@ -371,6 +375,8 @@
     <ClInclude Include="src\lua\lua_GamepadButtonState.h" />
     <ClInclude Include="src\lua\lua_GamepadGamepadEvent.h" />
     <ClInclude Include="src\lua\lua_GameState.h" />
+    <ClInclude Include="src\lua\lua_Gesture.h" />
+    <ClInclude Include="src\lua\lua_GestureGestureEvent.h" />
     <ClInclude Include="src\lua\lua_Global.h" />
     <ClInclude Include="src\lua\lua_Image.h" />
     <ClInclude Include="src\lua\lua_ImageFormat.h" />

+ 18 - 0
gameplay/gameplay.vcxproj.filters

@@ -783,6 +783,15 @@
     <ClCompile Include="src\lua\lua_ScriptTarget.cpp">
       <Filter>lua</Filter>
     </ClCompile>
+    <ClCompile Include="src\PlatformLinux.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Gesture.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_GestureGestureEvent.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="src\Animation.h">
@@ -1556,6 +1565,15 @@
     <ClInclude Include="src\lua\lua_ScriptTarget.h">
       <Filter>lua</Filter>
     </ClInclude>
+    <ClInclude Include="src\Gesture.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Gesture.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_GestureGestureEvent.h">
+      <Filter>lua</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="src\gameplay-main-macosx.mm">

Разница между файлами не показана из-за своего большого размера
+ 1277 - 0
gameplay/gameplay.xcodeproj/project.pbxproj


+ 1 - 1
gameplay/src/AnimationValue.h

@@ -45,7 +45,7 @@ public:
      * Copies one or more float values into the AnimationValue.
      *
      * @param index The index of the first component to set the value for.
-     * @param vaules Array of values to copy into the AnimationValue.
+     * @param values Array of values to copy into the AnimationValue.
      * @param count Number of values to in the array to copy in.
      */
     void setFloats(unsigned int index, float* values, unsigned int count);

+ 25 - 0
gameplay/src/Game.cpp

@@ -441,6 +441,31 @@ bool Game::mouseEvent(Mouse::MouseEvent evt, int x, int y, int wheelDelta)
     return false;
 }
 
+void Game::recognizeGesture(Gesture::GestureEvent evt)
+{
+    Platform::recognizeGesture(evt);
+}
+
+void Game::gestureSwipeEvent(int x, int y, int direction)
+{
+}
+
+void Game::gesturePinchEvent(int x, int y, float scale)
+{
+}
+
+void Game::gestureRotateEvent(int x, int y, float angle)
+{
+}
+
+void Game::gestureTapEvent(int x, int y)
+{
+}
+
+void Game::gestureTapDoubleEvent(int x, int y)
+{
+}
+
 void Game::gamepadEvent(Gamepad::GamepadEvent evt, Gamepad* gamepad)
 {
 }

+ 74 - 4
gameplay/src/Game.h

@@ -4,8 +4,10 @@
 #include <queue>
 
 #include "Keyboard.h"
-#include "Touch.h"
 #include "Mouse.h"
+#include "Touch.h"
+#include "Gesture.h"
+#include "Gamepad.h"
 #include "AudioController.h"
 #include "AnimationController.h"
 #include "PhysicsController.h"
@@ -14,7 +16,7 @@
 #include "Rectangle.h"
 #include "Vector4.h"
 #include "TimeListener.h"
-#include "Gamepad.h"
+
 
 namespace gameplay
 {
@@ -260,7 +262,7 @@ public:
     AudioListener* getAudioListener();
 
     /**
-     * Menu callback on menu events for platforms with special menu keys or gestures.
+     * Menu callback on menu events for platforms with special menu keys or special platform gestures.
      */
     virtual void menuEvent();
     
@@ -351,6 +353,74 @@ public:
      */
     inline bool isCursorVisible();
 
+    /**
+     * Requests the game to recognize the specified gesture events.
+     *
+     * This can be called multiple times to recognize more that one gesture.
+     * Call with Gesture::NONE to unrecognize all gestures. Once a gesture
+     * is recognized the specific gesture event methods will
+     * begin to be called.
+     *
+     * Registering for:
+     *
+     * Gesture::SWIPE calls gestureSwipeEvent(..)
+     * Gesture::PINCH calls gesturePinchEvent(..)
+     * Gesture::ROTATE calls gestureRotateEvent(..)
+     * Gesture::TAP calls gestureTapEvent(..)
+     * Gesture::TAP_DOUBLE calls gestureTapDoubleEvent(..)
+     *
+     * @param evt The gesture event to start recognizing for
+     */
+    void recognizeGesture(Gesture::GestureEvent evt);
+
+    /**
+     * Gesture callback on Gesture::SWIPE events.
+     *
+     * @param x The x-coordinate of the start of the swipe.
+     * @param y The y-coordinate of the start of the swipe.
+     * @param direction The direction of the swipe
+     *
+     * @see Gesture::SWIPE_DIRECTION_UP
+     * @see Gesture::SWIPE_DIRECTION_DOWN
+     * @see Gesture::SWIPE_DIRECTION_LEFT
+     * @see Gesture::SWIPE_DIRECTION_RIGHT
+     */
+    virtual void gestureSwipeEvent(int x, int y, int direction);
+
+    /**
+     * Gesture callback on Gesture::PINCH events.
+     *
+     * @param x The centroid x-coordinate of the pinch.
+     * @param y The centroid y-coordinate of the pinch.
+     * @param scale The scale of the pinch.
+     */
+    virtual void gesturePinchEvent(int x, int y, float scale);
+
+    /**
+     * Gesture callback on Gesture::ROTATE events.
+     *
+     * @param x The centroid x-coordinate of the rotate.
+     * @param y The centroid y-coordinate of the rotate.
+     * @param angle The angle of the rotation.
+     */
+    virtual void gestureRotateEvent(int x, int y, float angle);
+
+    /**
+     * Gesture callback on Gesture::TAP events.
+     *
+     * @param x The x-coordinate of the tap.
+     * @param y The y-coordinate of the tap.
+     */
+    virtual void gestureTapEvent(int x, int y);
+
+    /**
+     * Gesture callback on Gesture::TAP_DOUBLE events.
+     *
+     * @param x The x-coordinate of the double tap.
+     * @param y The y-coordinate of the double tap.
+     */
+    virtual void gestureTapDoubleEvent(int x, int y);
+
     /**
      * Gamepad callback on gamepad events. Override to receive Gamepad::CONNECTED_EVENT 
      * and Gamepad::DISCONNECTED_EVENT.
@@ -359,7 +429,7 @@ public:
      * @param gamepad the gamepad the event occurred on
      */
     virtual void gamepadEvent(Gamepad::GamepadEvent evt, Gamepad* gamepad);
-    
+
     /**
      * Gets the number of gamepad's that can be used in the game. Includes gamepads not connected.
      * 

+ 3 - 2
gameplay/src/Gamepad.h

@@ -78,7 +78,7 @@ public:
      * Returns the specified joystick's value as a Vector2.
      *
      * @param joystickId The index of the joystick to get the value for.
-     * @param outValue The current x-axis and y-asix value displacement of the joystick.
+     * @param outValues The current x-axis and y-asix value displacement of the joystick.
      */
     void getJoystickAxisValues(unsigned int joystickId, Vector2* outValues) const;
 
@@ -130,7 +130,7 @@ private:
     /**
      * Constructs a gamepad from the specified .form file.
      *
-     * @param id The gamepad's id.
+     * @param handle The gamepad handle
      * @param formPath The path the the .form file.
      */ 
     Gamepad(unsigned int handle, const char* formPath);
@@ -139,6 +139,7 @@ private:
      * Constructs a physical gamepad.
      *
      * @param id The gamepad's id.
+     * @param handle The gamepad handle
      * @param buttonCount the number of buttons on the gamepad. 
      * @param joystickCount the number of joysticks on the gamepad.
      * @param triggerCount the number of triggers on the gamepad.

+ 57 - 0
gameplay/src/Gesture.h

@@ -0,0 +1,57 @@
+#ifndef GESTURE_H_
+#define GESTURE_H_
+
+namespace gameplay
+{
+
+/**
+ * Gesture event
+ */
+class Gesture
+{
+public:
+
+    /**
+     * The gesture event type.
+     */
+    enum GestureEvent
+    {
+        GESTURE_SWIPE   = 0,
+        GESTURE_PINCH,
+        GESTURE_ROTATE,
+        GESTURE_TAP,
+        GESTURE_TAP_DOUBLE,
+        GESTURE_NONE = -1
+    };
+
+    /**
+     * The up direction for a swipe event.
+     */
+    static const int SWIPE_DIRECTION_UP = 1 << 0;
+
+    /**
+     * The down direction for a swipe event.
+     */
+    static const int SWIPE_DIRECTION_DOWN = 1 << 1;
+
+    /**
+     * The left direction for a swipe event.
+     */
+    static const int SWIPE_DIRECTION_LEFT = 1 << 2;
+
+    /**
+     * The right direction for a swipe event.
+     */
+    static const int SWIPE_DIRECTION_RIGHT = 1 << 3;
+
+private:
+
+    /**
+     * Constructor. Used internally.
+     */
+    Gesture();
+};
+
+}
+
+#endif

+ 22 - 14
gameplay/src/Platform.h

@@ -1,10 +1,11 @@
 #ifndef PLATFORM_H_
 #define PLATFORM_H_
 
-#include "Touch.h"
+#include "Vector2.h"
 #include "Keyboard.h"
 #include "Mouse.h"
-#include "Vector2.h"
+#include "Touch.h"
+#include "Gesture.h"
 #include "Gamepad.h"
 
 namespace gameplay
@@ -97,6 +98,18 @@ public:
      */
     static void setVsync(bool enable);
 
+    /**
+     * Swaps the frame buffer on the device.
+     */
+    static void swapBuffers();
+
+    /**
+     * Sleeps synchronously for the given amount of time (in milliseconds).
+     *
+     * @param ms How long to sleep (in milliseconds).
+     */
+    static void sleep(long ms);
+
     /**
      * Set if multi-touch is enabled on the platform.
      *
@@ -165,11 +178,6 @@ public:
      * @param roll The accelerometer roll.
      */
     static void getAccelerometerValues(float* pitch, float* roll);
-
-    /**
-     * Swaps the frame buffer on the device.
-     */
-    static void swapBuffers();
     
     /**
      * Shows or hides the virtual keyboard (if supported).
@@ -178,6 +186,13 @@ public:
      */
     static void displayKeyboard(bool display);
 
+    /**
+     * Registers the platform for gesture recognition for the specified gesture event.
+     *
+     * @param evt The gesture event to recognize or Gesture::NONE to disable gesture recognition events.
+     */
+    static void recognizeGesture(Gesture::GestureEvent evt);
+
     /** 
      * Gets the number of gamepad devices connected to the Platform.
      *
@@ -317,13 +332,6 @@ public:
      * @see Mouse::MouseEvent
      */
     static bool mouseEventInternal(Mouse::MouseEvent evt, int x, int y, int wheelDelta);
-
-    /**
-     * Sleeps synchronously for the given amount of time (in milliseconds).
-     *
-     * @param ms How long to sleep (in milliseconds).
-     */
-    static void sleep(long ms);
     
 private:
 

+ 13 - 8
gameplay/src/PlatformAndroid.cpp

@@ -878,6 +878,18 @@ void Platform::setVsync(bool enable)
     __vsync = enable;
 }
 
+
+void Platform::swapBuffers()
+{
+    if (__eglDisplay && __eglSurface)
+        eglSwapBuffers(__eglDisplay, __eglSurface);
+}
+
+void Platform::sleep(long ms)
+{
+    usleep(ms * 1000);
+}
+
 void Platform::setMultiTouch(bool enabled)
 {
     __multiTouch = enabled;
@@ -947,12 +959,6 @@ bool Platform::isCursorVisible()
     return false;
 }
 
-void Platform::swapBuffers()
-{
-    if (__eglDisplay && __eglSurface)
-        eglSwapBuffers(__eglDisplay, __eglSurface);
-}
-
 void Platform::displayKeyboard(bool display)
 {
     if (display)
@@ -995,9 +1001,8 @@ bool Platform::mouseEventInternal(Mouse::MouseEvent evt, int x, int y, int wheel
     }
 }
 
-void Platform::sleep(long ms)
+void Platform::recognizeGesture(Gesture::GestureEvent evt)
 {
-    usleep(ms * 1000);
 }
 
 unsigned int Platform::getGamepadsConnected()

+ 13 - 8
gameplay/src/PlatformLinux.cpp

@@ -739,6 +739,16 @@ void Platform::setVsync(bool enable)
     __vsync = enable;
 }
 
+void Platform::swapBuffers()
+{
+    glXSwapBuffers(__display, __window);
+}
+
+void Platform::sleep(long ms)
+{
+    usleep(ms * 1000);
+}
+
 void Platform::setMultiTouch(bool enabled)
 {
     // not supported
@@ -796,11 +806,6 @@ bool Platform::isCursorVisible()
     return __cursorVisible;
 }
 
-void Platform::swapBuffers()
-{
-    glXSwapBuffers(__display, __window);
-}
-
 void Platform::displayKeyboard(bool display)
 {
     // not supported
@@ -840,9 +845,9 @@ bool Platform::mouseEventInternal(Mouse::MouseEvent evt, int x, int y, int wheel
     }
 }
 
-void Platform::sleep(long ms)
-{
-    usleep(ms * 1000);
+void Platform::recognizeGesture(Gesture::GestureEvent evt)
+{
+        // Do nothing
 }
 
 unsigned int Platform::getGamepadsConnected()

+ 13 - 8
gameplay/src/PlatformMacOSX.mm

@@ -758,6 +758,17 @@ void Platform::setVsync(bool enable)
     __vsync = enable;
 }
 
+void Platform::swapBuffers()
+{
+    if (__view)
+        CGLFlushDrawable((CGLContextObj)[[__view openGLContext] CGLContextObj]);
+}
+
+void Platform::sleep(long ms)
+{
+    usleep(ms * 1000);
+}
+
 void Platform::setMultiTouch(bool enabled)
 {
 }
@@ -829,12 +840,6 @@ bool Platform::isCursorVisible()
     return __cursorVisible;
 }
 
-void Platform::swapBuffers()
-{
-    if (__view)
-        CGLFlushDrawable((CGLContextObj)[[__view openGLContext] CGLContextObj]);
-}
-
 void Platform::displayKeyboard(bool display)
 {
     // Do nothing.
@@ -874,9 +879,9 @@ bool Platform::mouseEventInternal(Mouse::MouseEvent evt, int x, int y, int wheel
     }
 }
 
-void Platform::sleep(long ms)
+void Platform::recognizeGesture(Gesture::GestureEvent evt)
 {
-    usleep(ms * 1000);
+    // Do nothing
 }
 
 unsigned int Platform::getGamepadsConnected()

+ 132 - 14
gameplay/src/PlatformQNX.cpp

@@ -10,6 +10,12 @@
 #include <sys/keycodes.h>
 #include <screen/screen.h>
 #include <input/screen_helpers.h>
+#include <gestures/set.h>
+#include <gestures/swipe.h>
+#include <gestures/pinch.h>
+#include <gestures/rotate.h>
+#include <gestures/tap.h>
+#include <gestures/double_tap.h>
 #include <bps/bps.h>
 #include <bps/event.h>
 #include <bps/screen.h>
@@ -39,6 +45,9 @@ static bool __multiTouch = false;
 static float __pitch;
 static float __roll;
 static const char* __glExtensions;
+static struct gestures_set * __gestureSet;
+static bool __gestureEventsProcessed;
+static bool __gestureEvents[5];
 PFNGLBINDVERTEXARRAYOESPROC glBindVertexArray = NULL;
 PFNGLDELETEVERTEXARRAYSOESPROC glDeleteVertexArrays = NULL;
 PFNGLGENVERTEXARRAYSOESPROC glGenVertexArrays = NULL;
@@ -435,6 +444,65 @@ EGLenum checkErrorEGL(const char* msg)
     return error;
 }
 
+void gesture_callback(gesture_base_t* gesture, mtouch_event_t* event, void* param, int async)
+{
+    switch (gesture->type)
+    {
+    case GESTURE_SWIPE:
+        {
+            if (__gestureEvents[(unsigned int) Gesture::GESTURE_SWIPE])
+            {
+                gesture_swipe_t* swipe = (gesture_swipe_t*)gesture;
+                Game::getInstance()->gestureSwipeEvent(swipe->coords.x, swipe->coords.y, swipe->direction);
+            }
+        }
+        break;
+
+    case GESTURE_PINCH:
+        {
+            if (__gestureEvents[(unsigned int) Gesture::GESTURE_PINCH])
+            {
+                gesture_pinch_t* pinch = (gesture_pinch_t*)gesture;
+                float dist_x = (float)pinch->last_distance.x - (float)pinch->distance.x;
+                float dist_y = (float)pinch->last_distance.y - (float)pinch->distance.y;
+                float scale = sqrt( (dist_x * dist_x) + (dist_y * dist_y) );
+                Game::getInstance()->gesturePinchEvent(pinch->centroid.x, pinch->centroid.y, scale);
+            }
+        }
+        break;
+
+    case GESTURE_ROTATE:
+        {
+            if (__gestureEvents[(unsigned int) Gesture::GESTURE_ROTATE])
+            {
+                gesture_rotate_t* rotate = (gesture_rotate_t*)gesture;
+                Game::getInstance()->gestureRotateEvent(rotate->centroid.x, rotate->centroid.y, rotate->angle);
+            }
+        }
+        break;
+
+    case GESTURE_TAP:
+        {
+            if (__gestureEvents[(unsigned int) Gesture::GESTURE_TAP])
+            {
+                gesture_tap_t* tap = (gesture_tap_t*)gesture;
+                Game::getInstance()->gestureTapEvent(tap->touch_coords.x, tap->touch_coords.y);
+            }
+        }
+        break;
+
+    case GESTURE_DOUBLE_TAP:
+        {
+            if (__gestureEvents[(unsigned int) Gesture::GESTURE_TAP_DOUBLE])
+            {
+                gesture_tap_t* double_tap = (gesture_tap_t*)gesture;
+                Game::getInstance()->gestureTapDoubleEvent(double_tap->touch_coords.x, double_tap->touch_coords.y);
+            }
+        }
+        break;
+    }
+}
+
 Platform::Platform(Game* game)
     : _game(game)
 {
@@ -489,17 +557,22 @@ Platform* Platform::create(Game* game, void* attachToWindow)
     FileSystem::setResourcePath("./app/native/");
     Platform* platform = new Platform(game);
 
+    __gestureSet = gestures_set_alloc();
+    swipe_gesture_alloc(NULL, gesture_callback, __gestureSet);
+    pinch_gesture_alloc(NULL, gesture_callback, __gestureSet);
+    rotate_gesture_alloc(NULL, gesture_callback, __gestureSet);
+    tap_gesture_alloc(NULL, gesture_callback, __gestureSet);
+    double_tap_gesture_alloc(NULL, gesture_callback, __gestureSet);
+
     bps_initialize();
 
+    // Initialize navigator and orientation
     static const int SENSOR_RATE = 25000;
     sensor_set_rate(SENSOR_TYPE_AZIMUTH_PITCH_ROLL, SENSOR_RATE);
     sensor_set_skip_duplicates(SENSOR_TYPE_AZIMUTH_PITCH_ROLL, true);
     sensor_request_events(SENSOR_TYPE_AZIMUTH_PITCH_ROLL);
-
     navigator_request_events(0);
     navigator_rotation_lock(true);
-
-    // Determine initial orientation angle.
     orientation_direction_t direction;
     orientation_get(&direction, &__orientationAngle);
 
@@ -827,7 +900,10 @@ int Platform::enterMessagePump()
                     case SCREEN_EVENT_MTOUCH_TOUCH:
                     {
                         screen_get_mtouch_event(__screenEvent, &touchEvent, 0);
-                        if (__multiTouch || touchEvent.contact_id == 0)
+                        if (__gestureEventsProcessed)
+                            rc = gestures_set_process_event(__gestureSet, &touchEvent, NULL);
+
+                        if ( !rc && (__multiTouch || touchEvent.contact_id == 0))
                         {
                             gameplay::Platform::touchEventInternal(Touch::TOUCH_PRESS, touchEvent.x, touchEvent.y, touchEvent.contact_id);
                         }
@@ -837,7 +913,10 @@ int Platform::enterMessagePump()
                     case SCREEN_EVENT_MTOUCH_RELEASE:
                     {
                         screen_get_mtouch_event(__screenEvent, &touchEvent, 0);
-                        if (__multiTouch || touchEvent.contact_id == 0)
+                        if (__gestureEventsProcessed)
+                            rc = gestures_set_process_event(__gestureSet, &touchEvent, NULL);
+
+                        if (!rc && (__multiTouch || touchEvent.contact_id == 0))
                         {
                             gameplay::Platform::touchEventInternal(Touch::TOUCH_RELEASE, touchEvent.x, touchEvent.y, touchEvent.contact_id);
                         }
@@ -847,7 +926,10 @@ int Platform::enterMessagePump()
                     case SCREEN_EVENT_MTOUCH_MOVE:
                     {
                         screen_get_mtouch_event(__screenEvent, &touchEvent, 0);
-                        if (__multiTouch ||touchEvent.contact_id == 0)
+                        if (__gestureEventsProcessed)
+                            rc = gestures_set_process_event(__gestureSet, &touchEvent, NULL);
+
+                        if (!rc && (__multiTouch || touchEvent.contact_id == 0))
                         {
                             gameplay::Platform::touchEventInternal(Touch::TOUCH_MOVE, touchEvent.x, touchEvent.y, touchEvent.contact_id);
                         }
@@ -1077,6 +1159,17 @@ void Platform::setVsync(bool enable)
     __vsync = enable;
 }
 
+void Platform::swapBuffers()
+{
+    if (__eglDisplay && __eglSurface)
+        eglSwapBuffers(__eglDisplay, __eglSurface);
+}
+
+void Platform::sleep(long ms)
+{
+    usleep(ms * 1000);
+}
+
 void Platform::setMultiTouch(bool enabled)
 {
     __multiTouch = enabled;
@@ -1156,12 +1249,6 @@ bool Platform::isCursorVisible()
     return false;
 }
 
-void Platform::swapBuffers()
-{
-    if (__eglDisplay && __eglSurface)
-        eglSwapBuffers(__eglDisplay, __eglSurface);
-}
-
 void Platform::displayKeyboard(bool display)
 {
     if (display)
@@ -1204,9 +1291,40 @@ bool Platform::mouseEventInternal(Mouse::MouseEvent evt, int x, int y, int wheel
     }
 }
 
-void Platform::sleep(long ms)
+void Platform::recognizeGesture(Gesture::GestureEvent evt)
 {
-    usleep(ms * 1000);
+    switch(evt)
+    {
+    case Gesture::GESTURE_NONE:
+        __gestureEventsProcessed = false;
+        memset( __gestureEvents, 0, sizeof(__gestureEvents));
+        break;
+
+    case Gesture::GESTURE_SWIPE:
+        __gestureEventsProcessed = true;
+        __gestureEvents[(unsigned int) Gesture::GESTURE_SWIPE] = true;
+        break;
+
+    case Gesture::GESTURE_PINCH:
+        __gestureEventsProcessed = true;
+        __gestureEvents[(unsigned int) Gesture::GESTURE_PINCH] = true;
+            break;
+
+    case Gesture::GESTURE_ROTATE:
+        __gestureEventsProcessed = true;
+        __gestureEvents[(unsigned int) Gesture::GESTURE_ROTATE] = true;
+        break;
+
+    case Gesture::GESTURE_TAP:
+        __gestureEventsProcessed = true;
+        __gestureEvents[(unsigned int) Gesture::GESTURE_TAP] = true;
+        break;
+
+    case Gesture::GESTURE_TAP_DOUBLE:
+        __gestureEventsProcessed = true;
+        __gestureEvents[(unsigned int) Gesture::GESTURE_TAP_DOUBLE] = true;
+        break;
+    }
 }
 
 unsigned int Platform::getGamepadsConnected()

+ 15 - 10
gameplay/src/PlatformWin32.cpp

@@ -941,6 +941,17 @@ void Platform::setVsync(bool enable)
     __vsync = enable;
 }
 
+void Platform::swapBuffers()
+{
+    if (__hdc)
+        SwapBuffers(__hdc);
+}
+
+void Platform::sleep(long ms)
+{
+    Sleep(ms);
+}
+
 void Platform::setMultiTouch(bool enabled)
 {
     // not supported
@@ -1008,15 +1019,14 @@ bool Platform::isCursorVisible()
     return __cursorVisible;
 }
 
-void Platform::swapBuffers()
+void Platform::displayKeyboard(bool display)
 {
-    if (__hdc)
-        SwapBuffers(__hdc);
+    // Do nothing.
 }
 
-void Platform::displayKeyboard(bool display)
+void Platform::recognizeGesture(Gesture::GestureEvent evt)
 {
-    // Do nothing.
+    // Do nothing
 }
 
 unsigned int Platform::getGamepadsConnected()
@@ -1244,11 +1254,6 @@ bool Platform::mouseEventInternal(Mouse::MouseEvent evt, int x, int y, int wheel
     }
 }
 
-void Platform::sleep(long ms)
-{
-    Sleep(ms);
-}
-
 }
 
 #endif

+ 11 - 8
gameplay/src/PlatformiOS.mm

@@ -886,6 +886,16 @@ void Platform::setVsync(bool enable)
     __vsync = enable;
 }
 
+void Platform::swapBuffers()
+{
+    if (__view)
+        [__view swapBuffers];
+}
+void Platform::sleep(long ms)
+{
+    usleep(ms * 1000);
+}
+
 void Platform::getAccelerometerValues(float* pitch, float* roll)
 {
     [__appDelegate getAccelerometerPitch:pitch roll:roll];
@@ -929,12 +939,6 @@ bool Platform::isMultiTouch()
     return __view.multipleTouchEnabled;
 }
 
-void Platform::swapBuffers()
-{
-    if (__view)
-        [__view swapBuffers];
-}
-
 void Platform::displayKeyboard(bool display) 
 {
     if(__view) 
@@ -984,9 +988,8 @@ bool Platform::mouseEventInternal(Mouse::MouseEvent evt, int x, int y, int wheel
     }
 }    
 
-void Platform::sleep(long ms)
+void Platform::recognizeGesture(Gesture::GestureEvent evt)
 {
-    usleep(ms * 1000);
 }
 
 unsigned int Platform::getGamepadsConnected()

+ 0 - 1
gameplay/src/ScriptController.h

@@ -50,7 +50,6 @@ public:
 	 * Individual items in the array can be set using the 
 	 * set(unsigned int, const T&) method.
 	 * 
-	 * @param object Parameter object.
 	 * @param count Number of elements to store in the parameter.
 	 */
 	LuaArray(int count);

+ 0 - 1
gameplay/src/Touch.h

@@ -21,7 +21,6 @@ public:
         TOUCH_MOVE
     };
 
-
 private:
 
     /**

+ 4 - 3
gameplay/src/gameplay.h

@@ -3,11 +3,12 @@
 #include "Platform.h"
 #include "Game.h"
 #include "Keyboard.h"
-#include "Touch.h"
 #include "Mouse.h"
+#include "Touch.h"
+#include "Gesture.h"
+#include "Gamepad.h"
 #include "FileSystem.h"
 #include "Bundle.h"
-#include "Gamepad.h"
 
 // Math
 #include "Rectangle.h"
@@ -95,4 +96,4 @@
 #include "Layout.h"
 #include "AbsoluteLayout.h"
 #include "VerticalLayout.h"
-
+#include "FlowLayout.h"

+ 267 - 0
gameplay/src/lua/lua_Game.cpp

@@ -11,6 +11,7 @@
 #include "lua_GameClearFlags.h"
 #include "lua_GameState.h"
 #include "lua_GamepadGamepadEvent.h"
+#include "lua_GestureGestureEvent.h"
 #include "lua_KeyboardKeyEvent.h"
 #include "lua_MouseMouseEvent.h"
 #include "lua_TouchTouchEvent.h"
@@ -27,6 +28,11 @@ void luaRegister_Game()
         {"exit", lua_Game_exit},
         {"frame", lua_Game_frame},
         {"gamepadEvent", lua_Game_gamepadEvent},
+        {"gesturePinchEvent", lua_Game_gesturePinchEvent},
+        {"gestureRotateEvent", lua_Game_gestureRotateEvent},
+        {"gestureSwipeEvent", lua_Game_gestureSwipeEvent},
+        {"gestureTapDoubleEvent", lua_Game_gestureTapDoubleEvent},
+        {"gestureTapEvent", lua_Game_gestureTapEvent},
         {"getAIController", lua_Game_getAIController},
         {"getAccelerometerValues", lua_Game_getAccelerometerValues},
         {"getAnimationController", lua_Game_getAnimationController},
@@ -52,6 +58,7 @@ void luaRegister_Game()
         {"menuEvent", lua_Game_menuEvent},
         {"mouseEvent", lua_Game_mouseEvent},
         {"pause", lua_Game_pause},
+        {"recognizeGesture", lua_Game_recognizeGesture},
         {"resume", lua_Game_resume},
         {"run", lua_Game_run},
         {"schedule", lua_Game_schedule},
@@ -365,6 +372,228 @@ int lua_Game_gamepadEvent(lua_State* state)
     return 0;
 }
 
+int lua_Game_gesturePinchEvent(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 4:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                int param1 = (int)luaL_checkint(state, 2);
+
+                // Get parameter 2 off the stack.
+                int param2 = (int)luaL_checkint(state, 3);
+
+                // Get parameter 3 off the stack.
+                float param3 = (float)luaL_checknumber(state, 4);
+
+                Game* instance = getInstance(state);
+                instance->gesturePinchEvent(param1, param2, param3);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Game_gesturePinchEvent - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 4).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Game_gestureRotateEvent(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 4:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                int param1 = (int)luaL_checkint(state, 2);
+
+                // Get parameter 2 off the stack.
+                int param2 = (int)luaL_checkint(state, 3);
+
+                // Get parameter 3 off the stack.
+                float param3 = (float)luaL_checknumber(state, 4);
+
+                Game* instance = getInstance(state);
+                instance->gestureRotateEvent(param1, param2, param3);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Game_gestureRotateEvent - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 4).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Game_gestureSwipeEvent(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 4:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                int param1 = (int)luaL_checkint(state, 2);
+
+                // Get parameter 2 off the stack.
+                int param2 = (int)luaL_checkint(state, 3);
+
+                // Get parameter 3 off the stack.
+                int param3 = (int)luaL_checkint(state, 4);
+
+                Game* instance = getInstance(state);
+                instance->gestureSwipeEvent(param1, param2, param3);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Game_gestureSwipeEvent - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 4).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Game_gestureTapDoubleEvent(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 3:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                int param1 = (int)luaL_checkint(state, 2);
+
+                // Get parameter 2 off the stack.
+                int param2 = (int)luaL_checkint(state, 3);
+
+                Game* instance = getInstance(state);
+                instance->gestureTapDoubleEvent(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Game_gestureTapDoubleEvent - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Game_gestureTapEvent(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 3:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                int param1 = (int)luaL_checkint(state, 2);
+
+                // Get parameter 2 off the stack.
+                int param2 = (int)luaL_checkint(state, 3);
+
+                Game* instance = getInstance(state);
+                instance->gestureTapEvent(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Game_gestureTapEvent - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Game_getAIController(lua_State* state)
 {
     // Get the number of parameters.
@@ -1395,6 +1624,44 @@ int lua_Game_pause(lua_State* state)
     return 0;
 }
 
+int lua_Game_recognizeGesture(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                Gesture::GestureEvent param1 = (Gesture::GestureEvent)lua_enumFromString_GestureGestureEvent(luaL_checkstring(state, 2));
+
+                Game* instance = getInstance(state);
+                instance->recognizeGesture(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Game_recognizeGesture - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Game_resume(lua_State* state)
 {
     // Get the number of parameters.

+ 6 - 0
gameplay/src/lua/lua_Game.h

@@ -11,6 +11,11 @@ int lua_Game_displayKeyboard(lua_State* state);
 int lua_Game_exit(lua_State* state);
 int lua_Game_frame(lua_State* state);
 int lua_Game_gamepadEvent(lua_State* state);
+int lua_Game_gesturePinchEvent(lua_State* state);
+int lua_Game_gestureRotateEvent(lua_State* state);
+int lua_Game_gestureSwipeEvent(lua_State* state);
+int lua_Game_gestureTapDoubleEvent(lua_State* state);
+int lua_Game_gestureTapEvent(lua_State* state);
 int lua_Game_getAIController(lua_State* state);
 int lua_Game_getAccelerometerValues(lua_State* state);
 int lua_Game_getAnimationController(lua_State* state);
@@ -36,6 +41,7 @@ int lua_Game_keyEvent(lua_State* state);
 int lua_Game_menuEvent(lua_State* state);
 int lua_Game_mouseEvent(lua_State* state);
 int lua_Game_pause(lua_State* state);
+int lua_Game_recognizeGesture(lua_State* state);
 int lua_Game_resume(lua_State* state);
 int lua_Game_run(lua_State* state);
 int lua_Game_schedule(lua_State* state);

+ 143 - 0
gameplay/src/lua/lua_Gesture.cpp

@@ -0,0 +1,143 @@
+#include "Base.h"
+#include "ScriptController.h"
+#include "lua_Gesture.h"
+#include "Gesture.h"
+
+namespace gameplay
+{
+
+void luaRegister_Gesture()
+{
+    const luaL_Reg lua_members[] = 
+    {
+        {NULL, NULL}
+    };
+    const luaL_Reg lua_statics[] = 
+    {
+        {"SWIPE_DIRECTION_DOWN", lua_Gesture_static_SWIPE_DIRECTION_DOWN},
+        {"SWIPE_DIRECTION_LEFT", lua_Gesture_static_SWIPE_DIRECTION_LEFT},
+        {"SWIPE_DIRECTION_RIGHT", lua_Gesture_static_SWIPE_DIRECTION_RIGHT},
+        {"SWIPE_DIRECTION_UP", lua_Gesture_static_SWIPE_DIRECTION_UP},
+        {NULL, NULL}
+    };
+    std::vector<std::string> scopePath;
+
+    ScriptUtil::registerClass("Gesture", lua_members, NULL, lua_Gesture__gc, lua_statics, scopePath);
+}
+
+static Gesture* getInstance(lua_State* state)
+{
+    void* userdata = luaL_checkudata(state, 1, "Gesture");
+    luaL_argcheck(state, userdata != NULL, 1, "'Gesture' expected.");
+    return (Gesture*)((ScriptUtil::LuaObject*)userdata)->instance;
+}
+
+int lua_Gesture__gc(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
+            {
+                void* userdata = luaL_checkudata(state, 1, "Gesture");
+                luaL_argcheck(state, userdata != NULL, 1, "'Gesture' expected.");
+                ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)userdata;
+                if (object->owns)
+                {
+                    Gesture* instance = (Gesture*)object->instance;
+                    SAFE_DELETE(instance);
+                }
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Gesture__gc - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Gesture_static_SWIPE_DIRECTION_DOWN(lua_State* state)
+{
+    // Validate the number of parameters.
+    if (lua_gettop(state) > 0)
+    {
+        lua_pushstring(state, "Invalid number of parameters (expected 0).");
+        lua_error(state);
+    }
+
+    int result = Gesture::SWIPE_DIRECTION_DOWN;
+
+    // Push the return value onto the stack.
+    lua_pushinteger(state, result);
+
+    return 1;
+}
+
+int lua_Gesture_static_SWIPE_DIRECTION_LEFT(lua_State* state)
+{
+    // Validate the number of parameters.
+    if (lua_gettop(state) > 0)
+    {
+        lua_pushstring(state, "Invalid number of parameters (expected 0).");
+        lua_error(state);
+    }
+
+    int result = Gesture::SWIPE_DIRECTION_LEFT;
+
+    // Push the return value onto the stack.
+    lua_pushinteger(state, result);
+
+    return 1;
+}
+
+int lua_Gesture_static_SWIPE_DIRECTION_RIGHT(lua_State* state)
+{
+    // Validate the number of parameters.
+    if (lua_gettop(state) > 0)
+    {
+        lua_pushstring(state, "Invalid number of parameters (expected 0).");
+        lua_error(state);
+    }
+
+    int result = Gesture::SWIPE_DIRECTION_RIGHT;
+
+    // Push the return value onto the stack.
+    lua_pushinteger(state, result);
+
+    return 1;
+}
+
+int lua_Gesture_static_SWIPE_DIRECTION_UP(lua_State* state)
+{
+    // Validate the number of parameters.
+    if (lua_gettop(state) > 0)
+    {
+        lua_pushstring(state, "Invalid number of parameters (expected 0).");
+        lua_error(state);
+    }
+
+    int result = Gesture::SWIPE_DIRECTION_UP;
+
+    // Push the return value onto the stack.
+    lua_pushinteger(state, result);
+
+    return 1;
+}
+
+}

+ 18 - 0
gameplay/src/lua/lua_Gesture.h

@@ -0,0 +1,18 @@
+#ifndef LUA_GESTURE_H_
+#define LUA_GESTURE_H_
+
+namespace gameplay
+{
+
+// Lua bindings for Gesture.
+int lua_Gesture__gc(lua_State* state);
+int lua_Gesture_static_SWIPE_DIRECTION_DOWN(lua_State* state);
+int lua_Gesture_static_SWIPE_DIRECTION_LEFT(lua_State* state);
+int lua_Gesture_static_SWIPE_DIRECTION_RIGHT(lua_State* state);
+int lua_Gesture_static_SWIPE_DIRECTION_UP(lua_State* state);
+
+void luaRegister_Gesture();
+
+}
+
+#endif

+ 53 - 0
gameplay/src/lua/lua_GestureGestureEvent.cpp

@@ -0,0 +1,53 @@
+#include "Base.h"
+#include "lua_GestureGestureEvent.h"
+
+namespace gameplay
+{
+
+static const char* enumStringEmpty = "";
+
+static const char* luaEnumString_GestureGestureEvent_GESTURE_SWIPE = "GESTURE_SWIPE";
+static const char* luaEnumString_GestureGestureEvent_GESTURE_PINCH = "GESTURE_PINCH";
+static const char* luaEnumString_GestureGestureEvent_GESTURE_ROTATE = "GESTURE_ROTATE";
+static const char* luaEnumString_GestureGestureEvent_GESTURE_TAP = "GESTURE_TAP";
+static const char* luaEnumString_GestureGestureEvent_GESTURE_TAP_DOUBLE = "GESTURE_TAP_DOUBLE";
+static const char* luaEnumString_GestureGestureEvent_GESTURE_NONE = "GESTURE_NONE";
+
+Gesture::GestureEvent lua_enumFromString_GestureGestureEvent(const char* s)
+{
+    if (strcmp(s, luaEnumString_GestureGestureEvent_GESTURE_SWIPE) == 0)
+        return Gesture::GESTURE_SWIPE;
+    if (strcmp(s, luaEnumString_GestureGestureEvent_GESTURE_PINCH) == 0)
+        return Gesture::GESTURE_PINCH;
+    if (strcmp(s, luaEnumString_GestureGestureEvent_GESTURE_ROTATE) == 0)
+        return Gesture::GESTURE_ROTATE;
+    if (strcmp(s, luaEnumString_GestureGestureEvent_GESTURE_TAP) == 0)
+        return Gesture::GESTURE_TAP;
+    if (strcmp(s, luaEnumString_GestureGestureEvent_GESTURE_TAP_DOUBLE) == 0)
+        return Gesture::GESTURE_TAP_DOUBLE;
+    if (strcmp(s, luaEnumString_GestureGestureEvent_GESTURE_NONE) == 0)
+        return Gesture::GESTURE_NONE;
+    GP_ERROR("Invalid enumeration value '%s' for enumeration Gesture::GestureEvent.", s);
+    return Gesture::GESTURE_SWIPE;
+}
+
+const char* lua_stringFromEnum_GestureGestureEvent(Gesture::GestureEvent e)
+{
+    if (e == Gesture::GESTURE_SWIPE)
+        return luaEnumString_GestureGestureEvent_GESTURE_SWIPE;
+    if (e == Gesture::GESTURE_PINCH)
+        return luaEnumString_GestureGestureEvent_GESTURE_PINCH;
+    if (e == Gesture::GESTURE_ROTATE)
+        return luaEnumString_GestureGestureEvent_GESTURE_ROTATE;
+    if (e == Gesture::GESTURE_TAP)
+        return luaEnumString_GestureGestureEvent_GESTURE_TAP;
+    if (e == Gesture::GESTURE_TAP_DOUBLE)
+        return luaEnumString_GestureGestureEvent_GESTURE_TAP_DOUBLE;
+    if (e == Gesture::GESTURE_NONE)
+        return luaEnumString_GestureGestureEvent_GESTURE_NONE;
+    GP_ERROR("Invalid enumeration value '%d' for enumeration Gesture::GestureEvent.", e);
+    return enumStringEmpty;
+}
+
+}
+

+ 15 - 0
gameplay/src/lua/lua_GestureGestureEvent.h

@@ -0,0 +1,15 @@
+#ifndef LUA_GESTUREGESTUREEVENT_H_
+#define LUA_GESTUREGESTUREEVENT_H_
+
+#include "Gesture.h"
+
+namespace gameplay
+{
+
+// Lua bindings for enum conversion functions for Gesture::GestureEvent.
+Gesture::GestureEvent lua_enumFromString_GestureGestureEvent(const char* s);
+const char* lua_stringFromEnum_GestureGestureEvent(Gesture::GestureEvent e);
+
+}
+
+#endif

+ 14 - 0
gameplay/src/lua/lua_Global.cpp

@@ -356,6 +356,18 @@ void luaRegister_lua_Global()
         ScriptUtil::registerConstantString("DISCONNECTED_EVENT", "DISCONNECTED_EVENT", scopePath);
     }
 
+    // Register enumeration Gesture::GestureEvent.
+    {
+        std::vector<std::string> scopePath;
+        scopePath.push_back("Gesture");
+        ScriptUtil::registerConstantString("GESTURE_SWIPE", "GESTURE_SWIPE", scopePath);
+        ScriptUtil::registerConstantString("GESTURE_PINCH", "GESTURE_PINCH", scopePath);
+        ScriptUtil::registerConstantString("GESTURE_ROTATE", "GESTURE_ROTATE", scopePath);
+        ScriptUtil::registerConstantString("GESTURE_TAP", "GESTURE_TAP", scopePath);
+        ScriptUtil::registerConstantString("GESTURE_TAP_DOUBLE", "GESTURE_TAP_DOUBLE", scopePath);
+        ScriptUtil::registerConstantString("GESTURE_NONE", "GESTURE_NONE", scopePath);
+    }
+
     // Register enumeration Image::Format.
     {
         std::vector<std::string> scopePath;
@@ -799,6 +811,8 @@ const char* lua_stringFromEnumGlobal(std::string& enumname, unsigned int value)
         return lua_stringFromEnum_GamepadButtonState((Gamepad::ButtonState)value);
     if (enumname == "Gamepad::GamepadEvent")
         return lua_stringFromEnum_GamepadGamepadEvent((Gamepad::GamepadEvent)value);
+    if (enumname == "Gesture::GestureEvent")
+        return lua_stringFromEnum_GestureGestureEvent((Gesture::GestureEvent)value);
     if (enumname == "Image::Format")
         return lua_stringFromEnum_ImageFormat((Image::Format)value);
     if (enumname == "Keyboard::Key")

+ 1 - 0
gameplay/src/lua/lua_Global.h

@@ -17,6 +17,7 @@
 #include "lua_GameState.h"
 #include "lua_GamepadButtonState.h"
 #include "lua_GamepadGamepadEvent.h"
+#include "lua_GestureGestureEvent.h"
 #include "lua_ImageFormat.h"
 #include "lua_KeyboardKey.h"
 #include "lua_KeyboardKeyEvent.h"

+ 38 - 0
gameplay/src/lua/lua_Platform.cpp

@@ -2,6 +2,7 @@
 #include "ScriptController.h"
 #include "lua_Platform.h"
 #include "Platform.h"
+#include "lua_GestureGestureEvent.h"
 #include "lua_KeyboardKeyEvent.h"
 #include "lua_MouseMouseEvent.h"
 #include "lua_TouchTouchEvent.h"
@@ -42,6 +43,7 @@ void luaRegister_Platform()
         {"isVsync", lua_Platform_static_isVsync},
         {"keyEventInternal", lua_Platform_static_keyEventInternal},
         {"mouseEventInternal", lua_Platform_static_mouseEventInternal},
+        {"recognizeGesture", lua_Platform_static_recognizeGesture},
         {"setAbsoluteTime", lua_Platform_static_setAbsoluteTime},
         {"setCursorVisible", lua_Platform_static_setCursorVisible},
         {"setMouseCaptured", lua_Platform_static_setMouseCaptured},
@@ -1015,6 +1017,42 @@ int lua_Platform_static_mouseEventInternal(lua_State* state)
     return 0;
 }
 
+int lua_Platform_static_recognizeGesture(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                Gesture::GestureEvent param1 = (Gesture::GestureEvent)lua_enumFromString_GestureGestureEvent(luaL_checkstring(state, 1));
+
+                Platform::recognizeGesture(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Platform_static_recognizeGesture - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Platform_static_setAbsoluteTime(lua_State* state)
 {
     // Get the number of parameters.

+ 1 - 0
gameplay/src/lua/lua_Platform.h

@@ -31,6 +31,7 @@ int lua_Platform_static_isMultiTouch(lua_State* state);
 int lua_Platform_static_isVsync(lua_State* state);
 int lua_Platform_static_keyEventInternal(lua_State* state);
 int lua_Platform_static_mouseEventInternal(lua_State* state);
+int lua_Platform_static_recognizeGesture(lua_State* state);
 int lua_Platform_static_setAbsoluteTime(lua_State* state);
 int lua_Platform_static_setCursorVisible(lua_State* state);
 int lua_Platform_static_setMouseCaptured(lua_State* state);

+ 1 - 0
gameplay/src/lua/lua_all_bindings.cpp

@@ -45,6 +45,7 @@ void lua_RegisterAllBindings()
     luaRegister_Frustum();
     luaRegister_Game();
     luaRegister_Gamepad();
+    luaRegister_Gesture();
     luaRegister_Image();
     luaRegister_Joint();
     luaRegister_Joystick();

+ 1 - 0
gameplay/src/lua/lua_all_bindings.h

@@ -40,6 +40,7 @@
 #include "lua_Frustum.h"
 #include "lua_Game.h"
 #include "lua_Gamepad.h"
+#include "lua_Gesture.h"
 #include "lua_Image.h"
 #include "lua_Joint.h"
 #include "lua_Joystick.h"

Некоторые файлы не были показаны из-за большого количества измененных файлов