[Y-devel] [PATCH] SDL Resize Patch

Doug Goldstein cardoe at cardoe.com
Mon Feb 23 20:47:40 GMT 2004


I took the original SDL Resize patch and made it work with 
Y--devel--0.2--patch-14. So here it is.

-Doug

--- orig/modules/drivers/video/sdl/sdl.c
+++ mod/modules/drivers/video/sdl/sdl.c
@@ -294,6 +294,8 @@
 {
   struct VideoDriver *videodriver;
   bool swcursor = false;
+  int screenx = 800;
+  int screeny = 600;
                                                                                                                                                                                              

   int i;
   for (i = 0; i < argc; ++i)
@@ -306,6 +308,26 @@
             }
         }
     }
+
+  for (i = 0; i < argc; ++i)
+    {
+      if (strncmp (argv[i], "res=", 4) == 0)
+       {
+         const char* res = argv[i] + 4;
+         const char* xloc = strchr(res,'x');
+         if(!xloc)
+           {
+             Y_ERROR ("sdl: Can't parse resolution string %s:",res);
+           }
+         else
+           {
+             screenx = atoi(res);
+             screeny = atoi(xloc + 1);
+             Y_ERROR ("sdl: Setting resolution to %i x 
%i",screenx,screeny);
+           }
+       }
+    }
+
                                                                                                                                                                                              

   if ( SDL_Init(SDL_INIT_EVERYTHING) < 0 )
     {
@@ -317,7 +339,7 @@
   videodriver -> d = ymalloc (sizeof (struct SDLVideoDriverData));
   videodriver -> module = module;
                                                                                                                                                                                              

-  sdlData(videodriver) -> sdlSurface = SDL_SetVideoMode(800, 600, 32, 
SDL_HWSURFACE|SDL_DOUBLEBUF|SDL_RESIZABLE);
+  sdlData(videodriver) -> sdlSurface = SDL_SetVideoMode(screenx, 
screeny, 32, SDL_HWSURFACE|SDL_DOUBLEBUF|SDL_RESIZABLE);
                                                                                                                                                                                              

   SDL_WM_SetCaption ("Y on SDL", NULL);





More information about the Y-devel mailing list









2026 © www.Y-Windows.Org - All Rights Reserved