rnd-20020315-2-src
[rocksndiamonds.git] / src / libgame / system.c
index 5217460d47f80ed11a9dc3dcb4b14b7de09790cf..bd9fc229206806112c19f051eb9e02d0615018bc 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Artsoft Retro-Game Library                               *
 *----------------------------------------------------------*
-* (c) 1994-2000 Artsoft Entertainment                      *
+* (c) 1994-2001 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
@@ -179,7 +179,7 @@ inline static int GetRealDepth(int depth)
 
 inline void InitVideoDisplay(void)
 {
-#ifdef TARGET_SDL
+#if defined(TARGET_SDL)
   SDLInitVideoDisplay();
 #else
   X11InitVideoDisplay();
@@ -188,7 +188,11 @@ inline void InitVideoDisplay(void)
 
 inline void CloseVideoDisplay(void)
 {
-#if defined(TARGET_X11)
+  KeyboardAutoRepeatOn();
+
+#if defined(TARGET_SDL)
+  SDL_QuitSubSystem(SDL_INIT_VIDEO);
+#else
   if (display)
     XCloseDisplay(display);
 #endif
@@ -371,7 +375,7 @@ inline void DrawSimpleWhiteLine(Bitmap *bitmap, int from_x, int from_y,
                                int to_x, int to_y)
 {
 #ifdef TARGET_SDL
-  SDLDrawSimpleLine(bitmap->surface, from_x, from_y, to_x, to_y, 0xffffff);
+  SDLDrawSimpleLine(bitmap, from_x, from_y, to_x, to_y, 0xffffff);
 #else
   XSetForeground(display, bitmap->gc, WhitePixel(display, screen));
   XDrawLine(display, bitmap->drawable, bitmap->gc, from_x, from_y, to_x, to_y);
@@ -399,8 +403,8 @@ inline void DrawLine(Bitmap *bitmap, int from_x, int from_y,
        continue;
 
 #if defined(TARGET_SDL)
-      sge_Line(bitmap->surface,
-              from_x + dx, from_y + dy, to_x + dx, to_y + dy, pixel);
+      SDLDrawLine(bitmap,
+                 from_x + dx, from_y + dy, to_x + dx, to_y + dy, pixel);
 #elif defined(TARGET_ALLEGRO)
       AllegroDrawLine(bitmap->drawable, from_x + dx, from_y + dy,
                      to_x + dx, to_y + dy, pixel);
@@ -441,6 +445,8 @@ inline Pixel GetPixelFromRGB(Bitmap *bitmap, unsigned int color_r,
 
 #if defined(TARGET_SDL)
   pixel = SDL_MapRGB(bitmap->surface->format, color_r, color_g, color_b);
+#elif defined(TARGET_ALLEGRO)
+  pixel = AllegroAllocColorCell(color_r << 8, color_g << 8, color_b << 8);
 #elif defined(TARGET_X11_NATIVE)
   XColor xcolor;
 
@@ -647,7 +653,7 @@ inline boolean PendingEvent(void)
 inline void NextEvent(Event *event)
 {
 #ifdef TARGET_SDL
-  SDL_WaitEvent(event);
+  SDLNextEvent(event);
 #else
   XNextEvent(display, event);
 #endif