diff src/video/wincommon/SDL_sysevents.c @ 1251:86d0d01290ea

Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode, updated project files, VS2005 support, VGA mode, more device support, etc, etc, etc. Fixes Bugzilla #47 and #28. --ryan.
author Ryan C. Gordon <icculus@icculus.org>
date Thu, 19 Jan 2006 08:43:00 +0000
parents 51a8702d8ecd
children 7c7ddaf195bf
line wrap: on
line diff
--- a/src/video/wincommon/SDL_sysevents.c	Thu Jan 19 08:36:41 2006 +0000
+++ b/src/video/wincommon/SDL_sysevents.c	Thu Jan 19 08:43:00 2006 +0000
@@ -47,6 +47,7 @@
 #endif
 
 #ifdef _WIN32_WCE
+#include "SDL_gapivideo.h"
 #define NO_GETKEYBOARDSTATE
 #define NO_CHANGEDISPLAYSETTINGS
 #endif
@@ -101,6 +102,38 @@
 	}
 }
 
+/* for gapi landscape mode */
+static void GapiTransform(SDL_ScreenOrientation rotate, char hires, Sint16 *x, Sint16 *y) {
+	Sint16 rotatedX;
+	Sint16 rotatedY;
+
+	if (hires) {
+		*x = *x * 2;
+		*y = *y * 2;
+	}
+
+	switch(rotate) {
+		case SDL_ORIENTATION_UP:
+			break;
+		case SDL_ORIENTATION_RIGHT:
+			if (!SDL_VideoSurface)
+				break;
+			rotatedX = SDL_VideoSurface->w - *y;
+			rotatedY = *x;
+			*x = rotatedX;
+			*y = rotatedY;
+			break;
+		case SDL_ORIENTATION_LEFT:
+			if (!SDL_VideoSurface)
+				break;
+			rotatedX = *y;
+			rotatedY = SDL_VideoSurface->h - *x;
+			*x = rotatedX;
+			*y = rotatedY;
+			break;
+	}
+}
+
 #endif
 
 static void SDL_RestoreGameMode(void)
@@ -319,6 +352,10 @@
 						posted = SDL_PrivateMouseMotion(0, 1, x, y);
 					}
 				} else {
+#ifdef _WIN32_WCE
+					if (SDL_VideoSurface)
+						GapiTransform(this->hidden->userOrientation, this->hidden->hiresFix, &x, &y);
+#endif
 					posted = SDL_PrivateMouseMotion(0, 0, x, y);
 				}
 			}
@@ -407,6 +444,10 @@
 				} else {
 					x = (Sint16)LOWORD(lParam);
 					y = (Sint16)HIWORD(lParam);
+#ifdef _WIN32_WCE
+					if (SDL_VideoSurface)
+						GapiTransform(this->hidden->userOrientation, this->hidden->hiresFix, &x, &y);
+#endif
 				}
 				posted = SDL_PrivateMouseButton(
 							state, button, x, y);