diff src/video/win32/SDL_gdirender.c @ 4569:e1664f94f026

Andrey A. I made a video driver GAPI/RAW for WinCE (SDL-1.3). RAW mode has a priority, and also, GAPI mode works with environment "SDL_VIDEO_RENDERER=gapi" and for RAW mode "SDL_VIDEO_RENDERER=raw". I checked the work on the screens of VGA, WVGA, QVGA, WQVGA, HVGA, + tested all modes with WindowsMobile Emulator. Also, correctly draws the pointer position and the scale of the pointer for VGA/WVGA modes, correctly draws top left position for DM orientation screen, and portrait/landscape/square geometry the screen also correct. Also, I added a small fix for GDI fullscreen mode. Patch for latest revision SDL-1.3 in an attachment. Also added small path for mingw32ce build.
author Sam Lantinga <slouken@libsdl.org>
date Tue, 27 Jul 2010 21:31:28 -0700
parents f7b03b6838cb
children aa8888658021
line wrap: on
line diff
--- a/src/video/win32/SDL_gdirender.c	Fri Jul 23 21:33:00 2010 -0700
+++ b/src/video/win32/SDL_gdirender.c	Tue Jul 27 21:31:28 2010 -0700
@@ -184,6 +184,8 @@
         return NULL;
     }
 
+    windowdata->videodata->render = RENDER_GDI;
+
     renderer->DisplayModeChanged = GDI_DisplayModeChanged;
     renderer->CreateTexture = GDI_CreateTexture;
     renderer->QueryTexturePixels = GDI_QueryTexturePixels;
@@ -267,6 +269,34 @@
     }
     data->current_hbm = 0;
 
+#ifdef _WIN32_WCE
+    // check size for GDI fullscreen and rotate
+    if((window->flags & SDL_WINDOW_FULLSCREEN) &&
+        GetSystemMetrics(SM_CXSCREEN) != GetSystemMetrics(SM_CYSCREEN) &&
+        ((GetSystemMetrics(SM_CXSCREEN) < GetSystemMetrics(SM_CYSCREEN) && window->w > window->h) ||
+         (GetSystemMetrics(SM_CXSCREEN) > GetSystemMetrics(SM_CYSCREEN) && window->w < window->h)))
+    {
+	int orientation = WINCE_GetDMOrientation();
+	switch(orientation)
+	{
+	    case DMDO_0:   orientation = DMDO_90; break;
+	    case DMDO_270: orientation = DMDO_180; break;
+	    case DMDO_90:  orientation = DMDO_0; break;
+	    case DMDO_180: orientation = DMDO_270; break;
+
+	    default:
+		GDI_DestroyRenderer(renderer);
+		return NULL;
+	}
+
+	if(0 > WINCE_SetDMOrientation(orientation))
+	{
+	    GDI_DestroyRenderer(renderer);
+	    return NULL;
+	}
+    }
+#endif
+
     return renderer;
 }
 
@@ -416,6 +446,7 @@
         WIN_SetError("Couldn't create bitmap");
         return -1;
     }
+
     return 0;
 }