rnd-20001204-1-src
[rocksndiamonds.git] / src / libgame / sdl.c
index 2d6d16b5072df53ae1e1d64ac8e415b2e25c1a09..533d0366b5fd248953c6eced78a0a1ee14deed9b 100644 (file)
@@ -1,20 +1,21 @@
 /***********************************************************
-*  Rocks'n'Diamonds -- McDuffin Strikes Back!              *
+* Artsoft Retro-Game Library                               *
 *----------------------------------------------------------*
-*  ©1995 Artsoft Development                               *
-*        Holger Schemel                                    *
-*        33659 Bielefeld-Senne                             *
-*        Telefon: (0521) 493245                            *
-*        eMail: aeglos@valinor.owl.de                      *
-*               aeglos@uni-paderborn.de                    *
-*               q99492@pbhrzx.uni-paderborn.de             *
+* (c) 1994-2000 Artsoft Entertainment                      *
+*               Holger Schemel                             *
+*               Detmolder Strasse 189                      *
+*               33604 Bielefeld                            *
+*               Germany                                    *
+*               e-mail: info@artsoft.org                   *
 *----------------------------------------------------------*
-*  sdl.c                                                   *
+* sdl.c                                                    *
 ***********************************************************/
 
-#include "libgame.h"
+#include "system.h"
+#include "misc.h"
 
-#ifdef TARGET_SDL
+
+#if defined(TARGET_SDL)
 
 inline void SDLInitVideoDisplay(void)
 {
@@ -65,10 +66,11 @@ inline boolean SDLSetVideoMode(DrawBuffer *backbuffer, boolean fullscreen)
   {
     /* switch display to fullscreen mode, if available */
     DrawWindow window_old = *backbuffer;
-    DrawWindow window_new;
+    DrawWindow window_new = CreateBitmapStruct();
 
-    if ((window_new = SDL_SetVideoMode(video.width, video.height, video.depth,
-                                      surface_flags)) == NULL)
+    if ((window_new->surface = SDL_SetVideoMode(video.width, video.height,
+                                               video.depth, surface_flags))
+       == NULL)
     {
       /* switching display to fullscreen mode failed */
       Error(ERR_WARN, "SDL_SetVideoMode() failed: %s", SDL_GetError());
@@ -80,7 +82,7 @@ inline boolean SDLSetVideoMode(DrawBuffer *backbuffer, boolean fullscreen)
     else
     {
       if (window_old)
-       SDL_FreeSurface(window_old);
+       FreeBitmap(window_old);
       *backbuffer = window_new;
 
       video.fullscreen_enabled = TRUE;
@@ -92,10 +94,11 @@ inline boolean SDLSetVideoMode(DrawBuffer *backbuffer, boolean fullscreen)
   {
     /* switch display to window mode */
     DrawWindow window_old = *backbuffer;
-    DrawWindow window_new;
+    DrawWindow window_new = CreateBitmapStruct();
 
-    if ((window_new = SDL_SetVideoMode(video.width, video.height, video.depth,
-                                      surface_flags)) == NULL)
+    if ((window_new->surface = SDL_SetVideoMode(video.width, video.height,
+                                               video.depth, surface_flags))
+       == NULL)
     {
       /* switching display to window mode failed -- should not happen */
       Error(ERR_WARN, "SDL_SetVideoMode() failed: %s", SDL_GetError());
@@ -105,7 +108,7 @@ inline boolean SDLSetVideoMode(DrawBuffer *backbuffer, boolean fullscreen)
     else
     {
       if (window_old)
-       SDL_FreeSurface(window_old);
+       FreeBitmap(window_old);
       *backbuffer = window_new;
 
       video.fullscreen_enabled = FALSE;