Quellcode durchsuchen

Merge branch 'next-setaylor' of https://github.com/blackberry-gaming/GamePlay into next-setaylor

Sean Paul Taylor vor 13 Jahren
Ursprung
Commit
eab833f6c1
3 geänderte Dateien mit 20 neuen und 11 gelöschten Zeilen
  1. 2 2
      gameplay/src/PlatformMacOSX.mm
  2. 16 7
      gameplay/src/PlatformQNX.cpp
  3. 2 2
      gameplay/src/PlatformWin32.cpp

+ 2 - 2
gameplay/src/PlatformMacOSX.mm

@@ -251,8 +251,8 @@ static CVReturn MyDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTime
     if (__rightMouseDown)
     {
         // Update the pitch and roll by adding the scaled deltas.
-        __roll += -(float)(point.x - __lx) * ACCELEROMETER_FACTOR_X;
-        __pitch -= (float)(point.y - (WINDOW_HEIGHT - __ly)) * ACCELEROMETER_FACTOR_Y;
+        __roll += (float)(point.x - __lx) * ACCELEROMETER_FACTOR_X;
+        __pitch -= -(float)(point.y - (WINDOW_HEIGHT - __ly)) * ACCELEROMETER_FACTOR_Y;
     
         // Clamp the values to the valid range.
         __roll = max(min(__roll, 90.0f), -90.0f);

+ 16 - 7
gameplay/src/PlatformQNX.cpp

@@ -1046,13 +1046,22 @@ void Platform::getAccelerometerValues(float* pitch, float* roll)
     double tx, ty, tz;
     accelerometer_read_forces(&tx, &ty, &tz);
 
-    // Hack landscape adjustment only.
-    if (__orientationAngle == 0)
-    {
-        tx = -tx;
-        ty = -ty;
-        tz = -tz;
-    }
+    if (__orientationAngle == 90)
+	{
+		tx = -ty;
+		ty = tx;
+	}
+	else if (__orientationAngle == 180)
+	{
+		tx = -tx;
+		ty = -ty;
+		tz = -tz;
+	}
+	else if (__orientationAngle == 270)
+	{
+		tx = ty;
+		ty = -tx;
+	}
 
     if (pitch != NULL)
         *pitch = atan(ty / sqrt(tx * tx + tz * tz)) * 180.0f * M_1_PI;

+ 2 - 2
gameplay/src/PlatformWin32.cpp

@@ -340,8 +340,8 @@ LRESULT CALLBACK __WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
         else if (rMouseDown)
         {
             // Update the pitch and roll by adding the scaled deltas.
-            __roll += -(float)(LOWORD(lParam) - lx) * ACCELEROMETER_X_FACTOR;
-            __pitch += (float)(HIWORD(lParam) - ly) * ACCELEROMETER_Y_FACTOR;
+            __roll += (float)(LOWORD(lParam) - lx) * ACCELEROMETER_X_FACTOR;
+            __pitch += -(float)(HIWORD(lParam) - ly) * ACCELEROMETER_Y_FACTOR;
 
             // Clamp the values to the valid range.
             __roll = max(min(__roll, 90.0f), -90.0f);