changeset 2431:7e449145b6ca gsoc2008_iphone

Added some code to set proper screensize on iPhone
author Holmes Futrell <hfutrell@umail.ucsb.edu>
date Fri, 15 Aug 2008 00:56:43 +0000
parents 166821fa1591
children daf3baf72a45
files test/testbitmap.c
diffstat 1 files changed, 15 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/test/testbitmap.c	Fri Aug 15 00:54:21 2008 +0000
+++ b/test/testbitmap.c	Fri Aug 15 00:56:43 2008 +0000
@@ -67,8 +67,9 @@
     Uint16 color;
     Uint8 gradient;
     SDL_Color palette[256];
-
-
+	
+	int video_w, video_h;
+	
     /* Initialize SDL */
     if (SDL_Init(SDL_INIT_VIDEO) < 0) {
         fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
@@ -95,11 +96,19 @@
             quit(1);
         }
     }
-
+	
+#ifdef __IPHONEOS__
+	video_w = 320;
+	video_h = 480;
+#else
+	video_w = 640;
+	video_h = 480;
+#endif
+	
     /* Set 640x480 video mode */
-    if ((screen = SDL_SetVideoMode(640, 480, video_bpp, videoflags)) == NULL) {
-        fprintf(stderr, "Couldn't set 640x480x%d video mode: %s\n",
-                video_bpp, SDL_GetError());
+    if ((screen = SDL_SetVideoMode(video_w, video_h, video_bpp, videoflags)) == NULL) {
+        fprintf(stderr, "Couldn't set %%d%d video mode: %s\n",
+                video_w, video_h, video_bpp, SDL_GetError());
         quit(2);
     }