Browse Source

Fixed mouse events not being passed to forms on PlayBook.
Replaced tabs with spaces in some source files.

Darryl Gough 13 years ago
parent
commit
6fd51d9a78

+ 10 - 10
gameplay/src/PhysicsController.cpp

@@ -160,22 +160,22 @@ bool PhysicsController::sweepTest(PhysicsCollisionObject* object, const Vector3&
     {
     public:
 
-	    SweepTestCallback(PhysicsCollisionObject* me)
+        SweepTestCallback(PhysicsCollisionObject* me)
             : btCollisionWorld::ClosestConvexResultCallback(btVector3(0.0, 0.0, 0.0), btVector3(0.0, 0.0, 0.0)), me(me)
-	    {
-	    }
+        {
+        }
 
-	    btScalar addSingleResult(btCollisionWorld::LocalConvexResult& convexResult, bool normalInWorldSpace)
-	    {
+        btScalar addSingleResult(btCollisionWorld::LocalConvexResult& convexResult, bool normalInWorldSpace)
+        {
             PhysicsCollisionObject* object = reinterpret_cast<PhysicsCollisionObject*>(convexResult.m_hitCollisionObject->getUserPointer());
 
-		    if (object == me)
-			    return 1.0f;
+            if (object == me)
+                return 1.0f;
 
-		    return ClosestConvexResultCallback::addSingleResult(convexResult, normalInWorldSpace);
-	    }
+            return ClosestConvexResultCallback::addSingleResult(convexResult, normalInWorldSpace);
+        }
 
-	    PhysicsCollisionObject* me;
+        PhysicsCollisionObject* me;
     };
 
     PhysicsCollisionShape* shape = object->getCollisionShape();

+ 16 - 16
gameplay/src/PlatformQNX.cpp

@@ -508,7 +508,7 @@ Platform* Platform::create(Game* game)
 
     int rc = 0;
     int screenFormat = SCREEN_FORMAT_RGBA8888;
-#if defined(__QNXNTO__) && defined(__X86__)
+#ifdef __X86__
     int screenUsage = SCREEN_USAGE_OPENGL_ES2;
 #else
     int screenUsage = SCREEN_USAGE_DISPLAY|SCREEN_USAGE_OPENGL_ES2; // Physical device copy directly into physical display
@@ -767,7 +767,7 @@ void mouseOrTouchEvent(Mouse::MouseEvent mouseEvent, Touch::TouchEvent touchEven
 {
     if (!Game::getInstance()->mouseEvent(mouseEvent, x, y, 0))
     {
-        Game::getInstance()->touchEvent(touchEvent, x, y, 0);
+        Platform::touchEventInternal(touchEvent, x, y, 0);
     }
 }
 
@@ -956,20 +956,20 @@ int Platform::enterMessagePump()
                     break;
                 case NAVIGATOR_WINDOW_STATE:
                 {
-                	navigator_window_state_t state = navigator_event_get_window_state(event);
-                	switch (state)
-                	{
-                	case NAVIGATOR_WINDOW_FULLSCREEN:
-                		_game->resume();
-                		suspended = false;
-                		break;
-                	case NAVIGATOR_WINDOW_THUMBNAIL:
-                	case NAVIGATOR_WINDOW_INVISIBLE:
-                		_game->pause();
-                		suspended = true;
-                		break;
-                	}
-                	break;
+                    navigator_window_state_t state = navigator_event_get_window_state(event);
+                    switch (state)
+                    {
+                    case NAVIGATOR_WINDOW_FULLSCREEN:
+                        _game->resume();
+                        suspended = false;
+                        break;
+                    case NAVIGATOR_WINDOW_THUMBNAIL:
+                    case NAVIGATOR_WINDOW_INVISIBLE:
+                        _game->pause();
+                        suspended = true;
+                        break;
+                    }
+                    break;
                 }
                 case NAVIGATOR_EXIT:
                     _game->exit();

+ 35 - 35
gameplay/src/PlatformWin32.cpp

@@ -247,10 +247,10 @@ static gameplay::Keyboard::Key getKey(WPARAM win32KeyCode, bool shiftDown)
 
 void UpdateCapture(LPARAM lParam)
 {
-	if ((lParam & MK_LBUTTON) || (lParam & MK_MBUTTON) || (lParam & MK_RBUTTON))
-		SetCapture(__hwnd);
-	else
-		ReleaseCapture();
+    if ((lParam & MK_LBUTTON) || (lParam & MK_MBUTTON) || (lParam & MK_RBUTTON))
+        SetCapture(__hwnd);
+    else
+        ReleaseCapture();
 }
 
 LRESULT CALLBACK __WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -290,7 +290,7 @@ LRESULT CALLBACK __WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
         int x = GET_X_LPARAM(lParam);
         int y = GET_Y_LPARAM(lParam);
 
-		UpdateCapture(wParam);
+        UpdateCapture(wParam);
         if (!gameplay::Game::getInstance()->mouseEvent(gameplay::Mouse::MOUSE_PRESS_LEFT_BUTTON, x, y, 0))
         {
             gameplay::Platform::touchEventInternal(gameplay::Touch::TOUCH_PRESS, x, y, 0);
@@ -306,29 +306,29 @@ LRESULT CALLBACK __WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
         {
             gameplay::Platform::touchEventInternal(gameplay::Touch::TOUCH_RELEASE, x, y, 0);
         }
-		UpdateCapture(wParam);
+        UpdateCapture(wParam);
         return 0;
     }
     case WM_RBUTTONDOWN:
-		UpdateCapture(wParam);
-		lx = GET_X_LPARAM(lParam);
+        UpdateCapture(wParam);
+        lx = GET_X_LPARAM(lParam);
         ly = GET_Y_LPARAM(lParam);
         gameplay::Game::getInstance()->mouseEvent(gameplay::Mouse::MOUSE_PRESS_RIGHT_BUTTON, lx, ly, 0);
         break;
 
     case WM_RBUTTONUP:
         gameplay::Game::getInstance()->mouseEvent(gameplay::Mouse::MOUSE_RELEASE_RIGHT_BUTTON,  GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0);
-		UpdateCapture(wParam);
+        UpdateCapture(wParam);
         break;
 
     case WM_MBUTTONDOWN:
-		UpdateCapture(wParam);
+        UpdateCapture(wParam);
         gameplay::Game::getInstance()->mouseEvent(gameplay::Mouse::MOUSE_PRESS_MIDDLE_BUTTON,  GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0);
         break;
 
     case WM_MBUTTONUP:
         gameplay::Game::getInstance()->mouseEvent(gameplay::Mouse::MOUSE_RELEASE_MIDDLE_BUTTON,  GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0);
-		UpdateCapture(wParam);
+        UpdateCapture(wParam);
         break;
 
     case WM_MOUSEMOVE:
@@ -336,30 +336,30 @@ LRESULT CALLBACK __WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
         int x = GET_X_LPARAM(lParam);
         int y = GET_Y_LPARAM(lParam);
 
-		// Allow Game::mouseEvent a chance to handle (and possibly consume) the event.
-		if (!gameplay::Game::getInstance()->mouseEvent(gameplay::Mouse::MOUSE_MOVE, x, y, 0))
-		{
-			if ((wParam & MK_LBUTTON) == MK_LBUTTON)
-			{
-				// Mouse move events should be interpreted as touch move only if left mouse is held and the game did not consume the mouse event.
-				gameplay::Platform::touchEventInternal(gameplay::Touch::TOUCH_MOVE, x, y, 0);
-				return 0;
-			}
-			else if ((wParam & MK_RBUTTON) == MK_RBUTTON)
-			{
-				// Update the pitch and roll by adding the scaled deltas.
-				__roll += (float)(x - lx) * ACCELEROMETER_X_FACTOR;
-				__pitch += -(float)(y - ly) * ACCELEROMETER_Y_FACTOR;
-
-				// Clamp the values to the valid range.
-				__roll = max(min(__roll, 90.0f), -90.0f);
-				__pitch = max(min(__pitch, 90.0f), -90.0f);
-
-				// Update the last X/Y values.
-				lx = x;
-				ly = y;
-			}
-		}
+        // Allow Game::mouseEvent a chance to handle (and possibly consume) the event.
+        if (!gameplay::Game::getInstance()->mouseEvent(gameplay::Mouse::MOUSE_MOVE, x, y, 0))
+        {
+            if ((wParam & MK_LBUTTON) == MK_LBUTTON)
+            {
+                // Mouse move events should be interpreted as touch move only if left mouse is held and the game did not consume the mouse event.
+                gameplay::Platform::touchEventInternal(gameplay::Touch::TOUCH_MOVE, x, y, 0);
+                return 0;
+            }
+            else if ((wParam & MK_RBUTTON) == MK_RBUTTON)
+            {
+                // Update the pitch and roll by adding the scaled deltas.
+                __roll += (float)(x - lx) * ACCELEROMETER_X_FACTOR;
+                __pitch += -(float)(y - ly) * ACCELEROMETER_Y_FACTOR;
+
+                // Clamp the values to the valid range.
+                __roll = max(min(__roll, 90.0f), -90.0f);
+                __pitch = max(min(__pitch, 90.0f), -90.0f);
+
+                // Update the last X/Y values.
+                lx = x;
+                ly = y;
+            }
+        }
         break;
     }
 

+ 4 - 4
gameplay/src/ScreenDisplayer.h

@@ -14,10 +14,10 @@ class ScreenDisplayer
 {
 public:
 
-	/**
-	 * Constructor.
-	 */
-	ScreenDisplayer();
+    /**
+     * Constructor.
+     */
+    ScreenDisplayer();
 
     /**
      * Displays a screen using the {@link Game#renderOnce} mechanism for at least the given amount of time.