浏览代码

Fixed android default res def

Tim Newell 12 年之前
父节点
当前提交
c3b44a17c0

+ 4 - 1
engine/source/gui/guiCanvas.cc

@@ -32,6 +32,9 @@
 #include "gui/guiCanvas.h"
 #include "gui/guiCanvas.h"
 #include "game/gameInterface.h"
 #include "game/gameInterface.h"
 
 
+extern int _AndroidGetScreenWidth();
+extern int _AndroidGetScreenHeight();
+
 IMPLEMENT_CONOBJECT(GuiCanvas);
 IMPLEMENT_CONOBJECT(GuiCanvas);
 
 
 GuiCanvas *Canvas = NULL;
 GuiCanvas *Canvas = NULL;
@@ -414,7 +417,7 @@ GuiCanvas::GuiCanvas()
    mBounds.set(0, 0, IOS_DEFAULT_RESOLUTION_X, IOS_DEFAULT_RESOLUTION_Y);
    mBounds.set(0, 0, IOS_DEFAULT_RESOLUTION_X, IOS_DEFAULT_RESOLUTION_Y);
 #elif TORQUE_OS_ANDROID
 #elif TORQUE_OS_ANDROID
    //TODO: this need to access something else?
    //TODO: this need to access something else?
-   mBounds.set(0, 0, ANDROID_DEFAULT_RESOLUTION_X, ANDROID_DEFAULT_RESOLUTION_Y);
+   mBounds.set(0, 0, _AndroidGetScreenWidth(), _AndroidGetScreenHeight());
 #else
 #else
    mBounds.set(0, 0, MIN_RESOLUTION_X, MIN_RESOLUTION_Y);
    mBounds.set(0, 0, MIN_RESOLUTION_X, MIN_RESOLUTION_Y);
 #endif
 #endif

+ 1 - 1
engine/source/platformAndroid/AndroidOGLVideo.cpp

@@ -269,7 +269,7 @@ bool OpenGLDevice::setVerticalSync(bool on)
 
 
 Resolution Video::getDesktopResolution()
 Resolution Video::getDesktopResolution()
 {
 {
-    return Resolution(ANDROID_DEFAULT_RESOLUTION_X, ANDROID_DEFAULT_RESOLUTION_Y, ANDROID_DEFAULT_RESOLUTION_BIT_DEPTH);
+    return Resolution(_AndroidGetScreenWidth(), _AndroidGetScreenHeight(), ANDROID_DEFAULT_RESOLUTION_BIT_DEPTH);
 }
 }
 
 
 DisplayDevice *OpenGLDevice::create()
 DisplayDevice *OpenGLDevice::create()

+ 2 - 2
engine/source/platformAndroid/AndroidWindow.cpp

@@ -60,8 +60,8 @@ AndroidPlatState::AndroidPlatState()
 
 
     // start with something reasonable.
     // start with something reasonable.
     desktopBitsPixel = ANDROID_DEFAULT_RESOLUTION_BIT_DEPTH;
     desktopBitsPixel = ANDROID_DEFAULT_RESOLUTION_BIT_DEPTH;
-    desktopWidth = ANDROID_DEFAULT_RESOLUTION_X;
-    desktopHeight = ANDROID_DEFAULT_RESOLUTION_Y;
+    desktopWidth = _AndroidGetScreenWidth();
+    desktopHeight = _AndroidGetScreenHeight();
     fullscreen = true;
     fullscreen = true;
 
 
     osVersion = 0;
     osVersion = 0;

+ 3 - 36
engine/source/platformAndroid/T2DActivity.cpp

@@ -316,7 +316,7 @@ void androidKeyboardEvent(int keyval, bool make) {
    Game->postEvent(event);
    Game->postEvent(event);
 }
 }
 
 
-Vector<Point2I> rawLastTouches;
+Point2I rawLastTouches[10];
 
 
 // Handle touch and keyboard input from android OS
 // Handle touch and keyboard input from android OS
 static int32_t engine_handle_input(struct android_app* app, AInputEvent* event) {
 static int32_t engine_handle_input(struct android_app* app, AInputEvent* event) {
@@ -334,19 +334,9 @@ static int32_t engine_handle_input(struct android_app* app, AInputEvent* event)
         		point.x = AMotionEvent_getX(event, i);
         		point.x = AMotionEvent_getX(event, i);
         		point.y = AMotionEvent_getY(event, i);
         		point.y = AMotionEvent_getY(event, i);
 
 
-        		if (rawLastTouches.size() < i+1)
-        			rawLastTouches.push_back(point);
-        		else
-        		{
-        			rawLastTouches[i].x = point.x;
-        			rawLastTouches[i].y = point.y;
-        		}
 
 
-        	    /*S32 orientation = _AndroidGameGetOrientation();
-        	    if (orientation == ACONFIGURATION_ORIENTATION_PORT)
-        	    {
-        	    	point.y -= _AndroidGetPortraitTouchoffset();
-        	    }*/
+        		rawLastTouches[i].x = point.x;
+        		rawLastTouches[i].y = point.y;
 
 
         	    createMouseDownEvent(i, point.x, point.y, touchCount);
         	    createMouseDownEvent(i, point.x, point.y, touchCount);
         	}
         	}
@@ -363,16 +353,8 @@ static int32_t engine_handle_input(struct android_app* app, AInputEvent* event)
 				point.y = AMotionEvent_getY(event, i);
 				point.y = AMotionEvent_getY(event, i);
 				Point2I prevPoint = rawLastTouches[i];
 				Point2I prevPoint = rawLastTouches[i];
 
 
-				/*S32 orientation = _AndroidGameGetOrientation();
-				if (orientation == ACONFIGURATION_ORIENTATION_PORT)
-				{
-					point.y -= _AndroidGetPortraitTouchoffset();
-					prevPoint.y -= _AndroidGetPortraitTouchoffset();
-				}*/
 				createMouseUpEvent(i, point.x, point.y, prevPoint.x, prevPoint.y, touchCount);
 				createMouseUpEvent(i, point.x, point.y, prevPoint.x, prevPoint.y, touchCount);
 
 
-    	        //Luma: Tap support
-
     	        if (touchCount > 0)
     	        if (touchCount > 0)
     	        {
     	        {
     	            // this was a tap, so create a tap event
     	            // this was a tap, so create a tap event
@@ -391,12 +373,6 @@ static int32_t engine_handle_input(struct android_app* app, AInputEvent* event)
 				point.y = AMotionEvent_getY(event, i);
 				point.y = AMotionEvent_getY(event, i);
 				Point2I prevPoint = rawLastTouches[i];
 				Point2I prevPoint = rawLastTouches[i];
 
 
-				/*S32 orientation = _AndroidGameGetOrientation();
-				if (orientation == ACONFIGURATION_ORIENTATION_PORT)
-				{
-					point.y -= _AndroidGetPortraitTouchoffset();
-					prevPoint.y -= _AndroidGetPortraitTouchoffset();
-				}*/
 				createMouseMoveEvent(i, point.x, point.y, prevPoint.x, prevPoint.y);
 				createMouseMoveEvent(i, point.x, point.y, prevPoint.x, prevPoint.y);
 
 
 				rawLastTouches[i].x = point.x;
 				rawLastTouches[i].x = point.x;
@@ -415,17 +391,8 @@ static int32_t engine_handle_input(struct android_app* app, AInputEvent* event)
 				point.y = AMotionEvent_getY(event, i);
 				point.y = AMotionEvent_getY(event, i);
 				Point2I prevPoint = rawLastTouches[i];
 				Point2I prevPoint = rawLastTouches[i];
 
 
-				/*S32 orientation = _AndroidGameGetOrientation();
-				if (orientation == ACONFIGURATION_ORIENTATION_PORT)
-				{
-					point.y -= _AndroidGetPortraitTouchoffset();
-					prevPoint.y -= _AndroidGetPortraitTouchoffset();
-				}*/
-
 				createMouseUpEvent(i, point.x, point.y, prevPoint.x, prevPoint.y, touchCount);
 				createMouseUpEvent(i, point.x, point.y, prevPoint.x, prevPoint.y, touchCount);
 
 
-				//Luma: Tap support
-
 				if (touchCount > 0)
 				if (touchCount > 0)
 				{
 				{
 					// this was a tap, so create a tap event
 					// this was a tap, so create a tap event

+ 0 - 6
engine/source/platformAndroid/platformGL.h

@@ -49,12 +49,6 @@ extern AGLContext agl_ctx;
 #define MIN_RESOLUTION_BIT_DEPTH		16
 #define MIN_RESOLUTION_BIT_DEPTH		16
 #define MIN_RESOLUTION_XY_STRING		"480 320"
 #define MIN_RESOLUTION_XY_STRING		"480 320"
 
 
-#define ANDROID_DEFAULT_RESOLUTION_X		480
-#define ANDROID_DEFAULT_RESOLUTION_Y		480
-
-#define ANDROID_MAX_RESOLUTION_X			2048
-#define ANDROID_MAX_RESOLUTION_Y			2048
-
 #define ANDROID_DEFAULT_RESOLUTION_BIT_DEPTH	32
 #define ANDROID_DEFAULT_RESOLUTION_BIT_DEPTH	32
 
 
 #define ANDROID_SCREEN_PORTRAIT			0
 #define ANDROID_SCREEN_PORTRAIT			0