rnd-20001202-1-src
authorHolger Schemel <info@artsoft.org>
Sat, 2 Dec 2000 00:45:45 +0000 (01:45 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:35:18 +0000 (10:35 +0200)
src/init.c
src/joystick.c
src/libgame/joystick_TMP.h [deleted file]
src/libgame/misc.c
src/libgame/sdl.c
src/libgame/sdl.h
src/libgame/system.c
src/libgame/system.h
src/libgame/x11.c
src/libgame/x11.h
src/main.h

index d48e713c51b629d2e2c7a4acb617728d7313cbac..adfd3f2c34da9273e89e084ce310167b1c47c50f 100644 (file)
@@ -38,6 +38,7 @@ static void InitLevelInfo(void);
 static void InitNetworkServer(void);
 static void InitSound(void);
 static void InitSoundServer(void);
+static void InitDisplay(void);
 static void InitGfx(void);
 static void InitGfxBackground(void);
 static void LoadGfx(int, struct PictureFileInfo *);
@@ -73,7 +74,7 @@ void OpenAll(int argc, char *argv[])
   signal(SIGINT, CloseAllAndExit);
   signal(SIGTERM, CloseAllAndExit);
 
-  InitBufferedDisplay(&backbuffer, &window);
+  InitDisplay();
   InitEventFilter(FilterMouseMotionEvents);
 
   InitGfx();
@@ -307,6 +308,22 @@ void InitJoysticks()
 #endif /* !TARGET_SDL */
 }
 
+void InitDisplay()
+{
+  char *x11_icon_filename = getPath3(options.ro_base_directory,
+                                    GRAPHICS_DIRECTORY,
+                                    "rocks_icon.xbm");
+  char *x11_iconmask_filename = getPath3(options.ro_base_directory,
+                                        GRAPHICS_DIRECTORY,
+                                        "rocks_iconmask.xbm");
+
+  InitProgramInfo(program_name, PROGRAM_TITLE_STRING, WINDOW_TITLE_STRING,
+                 ICON_TITLE_STRING, x11_icon_filename, x11_iconmask_filename);
+  InitVideoDisplay();
+  InitVideoBuffer(&backbuffer, &window, WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH,
+                 setup.fullscreen);
+}
+
 void InitGfx()
 {
   int i, j;
@@ -515,7 +532,7 @@ void InitGfxBackground()
 {
   int x, y;
 
-  drawto = backbuffer = pix[PIX_DB_BACK];
+  drawto = backbuffer;
   fieldbuffer = pix[PIX_DB_FIELD];
   SetDrawtoField(DRAW_BACKBUFFER);
 
index 16d00d785a884f92bb311fcb283a84b7362b90ef..b21d682e3de4a33586984220baeac30e6a8e6499 100644 (file)
 
 #include "joystick.h"
 
+#define TRANSLATE_JOYSYMBOL_TO_JOYNAME 0
+#define TRANSLATE_JOYNAME_TO_JOYSYMBOL 1
+
+void translate_joyname(int *joysymbol, char **name, int mode)
+{
+  static struct
+  {
+    int joysymbol;
+    char *name;
+  } translate_joy[] =
+  {
+    { JOY_LEFT,                "joystick_left" },
+    { JOY_RIGHT,       "joystick_right" },
+    { JOY_UP,          "joystick_up" },
+    { JOY_DOWN,                "joystick_down" },
+    { JOY_BUTTON_1,    "joystick_button_1" },
+    { JOY_BUTTON_2,    "joystick_button_2" },
+  };
+
+  int i;
+
+  if (mode == TRANSLATE_JOYSYMBOL_TO_JOYNAME)
+  {
+    *name = "[undefined]";
+
+    for (i=0; i<6; i++)
+    {
+      if (*joysymbol == translate_joy[i].joysymbol)
+      {
+       *name = translate_joy[i].name;
+       break;
+      }
+    }
+  }
+  else if (mode == TRANSLATE_JOYNAME_TO_JOYSYMBOL)
+  {
+    *joysymbol = 0;
+
+    for (i=0; i<6; i++)
+    {
+      if (strcmp(*name, translate_joy[i].name) == 0)
+      {
+       *joysymbol = translate_joy[i].joysymbol;
+       break;
+      }
+    }
+  }
+}
+
+char *getJoyNameFromJoySymbol(int joysymbol)
+{
+  char *name;
+
+  translate_joyname(&joysymbol, &name, TRANSLATE_JOYSYMBOL_TO_JOYNAME);
+  return name;
+}
+
+int getJoySymbolFromJoyName(char *name)
+{
+  int joysymbol;
+
+  translate_joyname(&joysymbol, &name, TRANSLATE_JOYNAME_TO_JOYSYMBOL);
+  return joysymbol;
+}
+
+int getJoystickNrFromDeviceName(char *device_name)
+{
+  char c;
+  int joystick_nr = 0;
+
+  if (device_name == NULL || device_name[0] == '\0')
+    return 0;
+
+  c = device_name[strlen(device_name) - 1];
+
+  if (c >= '0' && c <= '9')
+    joystick_nr = (int)(c - '0');
+
+  if (joystick_nr < 0 || joystick_nr >= MAX_PLAYERS)
+    joystick_nr = 0;
+
+  return joystick_nr;
+}
+
 #if !defined(PLATFORM_MSDOS)
 static int JoystickPosition(int middle, int margin, int actual)
 {
diff --git a/src/libgame/joystick_TMP.h b/src/libgame/joystick_TMP.h
deleted file mode 100644 (file)
index ccf728a..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/***********************************************************
-*  Rocks'n'Diamonds -- McDuffin Strikes Back!              *
-*----------------------------------------------------------*
-*  (c) 1995-98 Artsoft Entertainment                       *
-*              Holger Schemel                              *
-*              Oststrasse 11a                              *
-*              33604 Bielefeld                             *
-*              phone: ++49 +521 290471                     *
-*              email: aeglos@valinor.owl.de                *
-*----------------------------------------------------------*
-*  joystick.h                                              *
-***********************************************************/
-
-#ifndef JOYSTICK_H
-#define JOYSTICK_H
-
-/* values for the joystick */
-#define JOYSTICK_OFF           0
-#define        JOYSTICK_AVAILABLE      1
-
-#ifdef __FreeBSD__
-#include <machine/joystick.h>
-#define DEV_JOYSTICK_0         "/dev/joy0"
-#define DEV_JOYSTICK_1         "/dev/joy1"
-#define DEV_JOYSTICK_2         "/dev/joy2"
-#define DEV_JOYSTICK_3         "/dev/joy3"
-#else
-#define DEV_JOYSTICK_0         "/dev/js0"
-#define DEV_JOYSTICK_1         "/dev/js1"
-#define DEV_JOYSTICK_2         "/dev/js2"
-#define DEV_JOYSTICK_3         "/dev/js3"
-#endif
-
-/* get these values from the program 'js' from the joystick package, */
-/* set JOYSTICK_PERCENT to a threshold appropriate for your joystick */
-
-#ifdef TARGET_SDL
-#define JOYSTICK_XLEFT         -32767
-#define JOYSTICK_XMIDDLE       0
-#define JOYSTICK_XRIGHT                32767
-#define JOYSTICK_YUPPER                -32767
-#define JOYSTICK_YMIDDLE       0
-#define JOYSTICK_YLOWER                32767
-#else
-#define JOYSTICK_XLEFT         30
-#define JOYSTICK_XMIDDLE       530
-#define JOYSTICK_XRIGHT                1250
-#define JOYSTICK_YUPPER                40
-#define JOYSTICK_YMIDDLE       680
-#define JOYSTICK_YLOWER                1440
-#endif
-
-#define JOYSTICK_PERCENT       25
-
-#define JOY_LEFT               MV_LEFT
-#define JOY_RIGHT              MV_RIGHT
-#define JOY_UP                 MV_UP
-#define JOY_DOWN               MV_DOWN
-#define JOY_BUTTON_1           (1<<4)
-#define JOY_BUTTON_2           (1<<5)
-#define JOY_BUTTON             (JOY_BUTTON_1 | JOY_BUTTON_2)
-
-#define JOY_BUTTON_NOT_PRESSED 0
-#define JOY_BUTTON_PRESSED     1
-#define JOY_BUTTON_NEW_PRESSED 2
-#define JOY_BUTTON_NEW_RELEASED        3
-
-#ifdef NO_JOYSTICK
-#define JOYSTICK_STATUS                JOYSTICK_OFF
-#else
-#define JOYSTICK_STATUS                JOYSTICK_AVAILABLE
-#endif
-
-
-#if defined(TARGET_SDL)
-SDL_Joystick *Get_SDL_Joystick(int);
-boolean Open_SDL_Joystick(int);
-void Close_SDL_Joystick(int);
-boolean Check_SDL_JoystickOpened(int);
-void HandleJoystickEvent(Event *);
-int Get_SDL_Joystick_Axis(int, int);
-#endif
-
-void CheckJoystickData(void);
-int Joystick(int);
-int JoystickButton(int);
-int AnyJoystick(void);
-int AnyJoystickButton(void);
-
-#endif /* JOYSTICK_H */
index bfc6d454d9652253e9766676960913783c469a9c..29e23929ea5c8db0afe9b31723ffaee3e6c88fea 100644 (file)
@@ -28,7 +28,9 @@
 
 #include "misc.h"
 
+#if 0
 #include "joystick_TMP.h"
+#endif
 
 #if defined(PLATFORM_MSDOS)
 volatile unsigned long counter = 0;
@@ -1056,90 +1058,6 @@ char getCharFromKey(Key key)
   return letter;
 }
 
-#define TRANSLATE_JOYSYMBOL_TO_JOYNAME 0
-#define TRANSLATE_JOYNAME_TO_JOYSYMBOL 1
-
-void translate_joyname(int *joysymbol, char **name, int mode)
-{
-  static struct
-  {
-    int joysymbol;
-    char *name;
-  } translate_joy[] =
-  {
-    { JOY_LEFT,                "joystick_left" },
-    { JOY_RIGHT,       "joystick_right" },
-    { JOY_UP,          "joystick_up" },
-    { JOY_DOWN,                "joystick_down" },
-    { JOY_BUTTON_1,    "joystick_button_1" },
-    { JOY_BUTTON_2,    "joystick_button_2" },
-  };
-
-  int i;
-
-  if (mode == TRANSLATE_JOYSYMBOL_TO_JOYNAME)
-  {
-    *name = "[undefined]";
-
-    for (i=0; i<6; i++)
-    {
-      if (*joysymbol == translate_joy[i].joysymbol)
-      {
-       *name = translate_joy[i].name;
-       break;
-      }
-    }
-  }
-  else if (mode == TRANSLATE_JOYNAME_TO_JOYSYMBOL)
-  {
-    *joysymbol = 0;
-
-    for (i=0; i<6; i++)
-    {
-      if (strcmp(*name, translate_joy[i].name) == 0)
-      {
-       *joysymbol = translate_joy[i].joysymbol;
-       break;
-      }
-    }
-  }
-}
-
-char *getJoyNameFromJoySymbol(int joysymbol)
-{
-  char *name;
-
-  translate_joyname(&joysymbol, &name, TRANSLATE_JOYSYMBOL_TO_JOYNAME);
-  return name;
-}
-
-int getJoySymbolFromJoyName(char *name)
-{
-  int joysymbol;
-
-  translate_joyname(&joysymbol, &name, TRANSLATE_JOYNAME_TO_JOYSYMBOL);
-  return joysymbol;
-}
-
-int getJoystickNrFromDeviceName(char *device_name)
-{
-  char c;
-  int joystick_nr = 0;
-
-  if (device_name == NULL || device_name[0] == '\0')
-    return 0;
-
-  c = device_name[strlen(device_name) - 1];
-
-  if (c >= '0' && c <= '9')
-    joystick_nr = (int)(c - '0');
-
-  if (joystick_nr < 0 || joystick_nr >= MAX_PLAYERS)
-    joystick_nr = 0;
-
-  return joystick_nr;
-}
-
 /* ------------------------------------------------------------------------- */
 /* some functions to handle lists of level directories                       */
 /* ------------------------------------------------------------------------- */
index 8e2ec948071686a17ba5f047c1edf16e28117bc0..edb861d9203bd13b0b8ca8be9f852204744cf314 100644 (file)
 
 #ifdef TARGET_SDL
 
-inline void SDLInitBufferedDisplay(DrawBuffer *backbuffer, DrawWindow *window)
+inline void SDLInitVideoDisplay(void)
 {
   /* initialize SDL video */
   if (SDL_Init(SDL_INIT_VIDEO) < 0)
     Error(ERR_EXIT, "SDL_Init() failed: %s", SDL_GetError());
 
-  /* automatically cleanup SDL stuff after exit() */
+  /* set default SDL depth */
+  video.default_depth = SDL_GetVideoInfo()->vfmt->BitsPerPixel;
+
+  /* set exit function to automatically cleanup SDL stuff after exit() */
   atexit(SDL_Quit);
+}
 
+inline void SDLInitVideoBuffer(DrawBuffer *backbuffer, DrawWindow *window,
+                              boolean fullscreen)
+{
   /* open SDL video output device (window or fullscreen mode) */
-  if (!SDLSetVideoMode(backbuffer))
+  if (!SDLSetVideoMode(backbuffer, fullscreen))
     Error(ERR_EXIT, "setting video mode failed");
 
   /* set window and icon title */
-  SDL_WM_SetCaption(WINDOW_TITLE_STRING, WINDOW_TITLE_STRING);
-
-  /* create additional buffer for double-buffering */
-  pix[PIX_DB_BACK] = CreateBitmap(WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH);
+  SDL_WM_SetCaption(program.window_title, program.window_title);
 
   /* SDL cannot directly draw to the visible video framebuffer like X11,
      but always uses a backbuffer, which is then blitted to the visible
@@ -48,13 +52,14 @@ inline void SDLInitBufferedDisplay(DrawBuffer *backbuffer, DrawWindow *window)
      buffer 'window' at the same size as the SDL backbuffer. Although it
      should never be drawn to directly, it would do no harm nevertheless. */
 
-  *window = pix[PIX_DB_BACK];          /* 'window' is only symbolic buffer */
-  pix[PIX_DB_BACK] = *backbuffer;      /* 'backbuffer' is SDL screen buffer */
+  /* create additional (symbolic) buffer for double-buffering */
+  *window = CreateBitmap(WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH);
 }
 
 inline boolean SDLSetVideoMode(DrawBuffer *backbuffer, boolean fullscreen)
 {
   boolean success = TRUE;
+  int surface_flags = SDL_HWSURFACE | (fullscreen ? SDL_FULLSCREEN : 0);
 
   if (fullscreen && !video.fullscreen_enabled && video.fullscreen_available)
   {
@@ -62,9 +67,8 @@ inline boolean SDLSetVideoMode(DrawBuffer *backbuffer, boolean fullscreen)
     DrawWindow window_old = *backbuffer;
     DrawWindow window_new;
 
-    if ((window_new = SDL_SetVideoMode(WIN_XSIZE, WIN_YSIZE, WIN_SDL_DEPTH,
-                                      SDL_HWSURFACE|SDL_FULLSCREEN))
-       == NULL)
+    if ((window_new = 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());
@@ -90,9 +94,8 @@ inline boolean SDLSetVideoMode(DrawBuffer *backbuffer, boolean fullscreen)
     DrawWindow window_old = *backbuffer;
     DrawWindow window_new;
 
-    if ((window_new = SDL_SetVideoMode(WIN_XSIZE, WIN_YSIZE, WIN_SDL_DEPTH,
-                                      SDL_HWSURFACE))
-       == NULL)
+    if ((window_new = 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());
index f150e7df0ac7d0050ebff8e2f5950cafcb8fff3c..a7147130fc0b06ed4f3700bc45ef94f480940fe9 100644 (file)
@@ -296,7 +296,8 @@ typedef int                 Colormap;
 
 /* SDL function definitions */
 
-inline void SDLInitBufferedDisplay(DrawBuffer *, DrawWindow *);
+inline void SDLInitVideoDisplay(void);
+inline void SDLInitVideoBuffer(DrawBuffer *, DrawWindow *);
 inline boolean SDLSetVideoMode(DrawBuffer *, boolean);
 inline void SDLCopyArea(SDL_Surface *, SDL_Surface *,
                         int, int, int, int, int, int);
index 5a55f1c248919f05f8e8c23c7cb3f277e10ba479..ee5e87ce996fa47a1405a1f44e2f370441913393 100644 (file)
@@ -34,6 +34,7 @@ int           FrameCounter;
 /* exported variables                                                        */
 /* ========================================================================= */
 
+struct ProgramInfo     program;
 struct VideoSystemInfo video;
 struct AudioSystemInfo audio;
 struct OptionInfo      options;
@@ -43,30 +44,53 @@ struct OptionInfo   options;
 /* video functions                                                           */
 /* ========================================================================= */
 
-inline void InitBufferedDisplay(DrawBuffer *backbuffer, DrawWindow *window)
+inline static int GetRealDepth(int depth)
 {
-  video.fullscreen_available = FULLSCREEN_STATUS;
-  video.fullscreen_enabled = FALSE;
+  return (depth == DEFAULT_DEPTH ? video.default_depth : depth);
+}
+
+inline void InitProgramInfo(char *command_name, char *program_title,
+                           char *window_title, char *icon_title,
+                           char *x11_icon_filename,
+                           char *x11_iconmask_filename)
+{
+  program.command_name = command_name;
+  program.program_title = program_title;
+  program.window_title = window_title;
+  program.icon_title = icon_title;
+  program.x11_icon_filename = x11_icon_filename;
+  program.x11_iconmask_filename = x11_iconmask_filename;
+}
 
+inline void InitVideoDisplay(void)
+{
 #ifdef TARGET_SDL
-  SDLInitBufferedDisplay(backbuffer, window);
+  SDLInitVideoDisplay();
 #else
-  X11InitBufferedDisplay(backbuffer, window);
+  X11InitVideoDisplay();
 #endif
 }
 
-inline int GetDisplayDepth(void)
+inline void InitVideoBuffer(DrawBuffer *backbuffer, DrawWindow *window,
+                           int width, int height, int depth,
+                           boolean fullscreen)
 {
+  video.width = width;
+  video.height = height;
+  video.depth = GetRealDepth(depth);
+  video.fullscreen_available = FULLSCREEN_STATUS;
+  video.fullscreen_enabled = FALSE;
+
 #ifdef TARGET_SDL
-  return SDL_GetVideoSurface()->format->BitsPerPixel;
+  SDLInitVideoBuffer(backbuffer, window, fullscreen);
 #else
-  return XDefaultDepth(display, screen);
+  X11InitVideoBuffer(backbuffer, window);
 #endif
 }
 
 inline Bitmap CreateBitmap(int width, int height, int depth)
 {
-  int real_depth = (depth == DEFAULT_DEPTH ? GetDisplayDepth() : depth);
+  int real_depth = GetRealDepth(depth);
 
 #ifdef TARGET_SDL
   SDL_Surface *surface_tmp, *surface_native;
index fe805c8aa6e4e04dbe0ce6e8bd928e5089314fef..5b9a1ef5cc3f342a86cc49a44742612df161edde 100644 (file)
@@ -43,8 +43,20 @@ typedef int (*EventFilter)(const Event *);
 
 /* structure definitions */
 
+struct ProgramInfo
+{
+  char *command_name;
+  char *program_title;
+  char *window_title;
+  char *icon_title;
+  char *x11_icon_filename;
+  char *x11_iconmask_filename;
+};
+
 struct VideoSystemInfo
 {
+  int default_depth;
+  int width, height, depth;
   boolean fullscreen_available;
   boolean fullscreen_enabled;
 };
@@ -78,6 +90,7 @@ struct OptionInfo
 /* exported variables                                                        */
 /* ========================================================================= */
 
+extern struct ProgramInfo      program;
 extern struct VideoSystemInfo  video;
 extern struct AudioSystemInfo  audio;
 extern struct OptionInfo       options;
@@ -98,8 +111,9 @@ extern int           FrameCounter;
 
 /* function definitions */
 
-inline void InitBufferedDisplay(DrawBuffer *, DrawWindow *);
-inline int GetDisplayDepth(void);
+inline void InitProgramInfo(char *, char *, char *, char *, char *, char *);
+inline void InitVideoDisplay(void);
+inline void InitVideoBuffer(DrawBuffer *,DrawWindow *, int, int, int, boolean);
 inline Bitmap CreateBitmap(int, int, int);
 inline void FreeBitmap(Bitmap);
 inline void ClearRectangle(Bitmap, int, int, int, int);
index 9de89c95eddf6b825d0db6fba7ec3925287e1e98..5d77d49d7f62244c549d7b157f5a27c9406a01dd 100644 (file)
 
 #if defined(TARGET_X11)
 
+#if 0
 #include "main_TMP.h"
+#endif
 
+#if 0
 struct IconFileInfo
 {
   char *picture_filename;
   char *picturemask_filename;
 };
+#endif
+
+static void X11InitDisplay();
+static DrawWindow X11InitWindow();
+
+inline void X11InitVideoDisplay(void)
+{
+  /* initialize X11 video */
+  X11InitDisplay();
+
+  /* set default X11 depth */
+  video.default_depth = XDefaultDepth(display, screen);
+}
+
+inline void X11InitVideoBuffer(DrawBuffer *backbuffer, DrawWindow *window)
+{
+  *window = X11InitWindow();
+
+  XMapWindow(display, *window);
+  FlushDisplay();
+
+  /* create additional (off-screen) buffer for double-buffering */
+  *backbuffer = CreateBitmap(video.width, video.height, video.depth);
+}
 
 static void X11InitDisplay()
 {
@@ -85,23 +112,25 @@ static DrawWindow X11InitWindow()
   XSizeHints size_hints;
   XWMHints wm_hints;
   XClassHint class_hints;
-  char *window_name = WINDOW_TITLE_STRING;
-  char *icon_name = WINDOW_TITLE_STRING;
+  char *window_name = program.window_title;
+  char *icon_name = program.window_title;
   long window_event_mask;
   Atom proto_atom = None, delete_atom = None;
 #endif
   int screen_width, screen_height;
-  int win_xpos = WIN_XPOS, win_ypos = WIN_YPOS;
+  int win_xpos, win_ypos;
   unsigned long pen_fg = WhitePixel(display,screen);
   unsigned long pen_bg = BlackPixel(display,screen);
-  const int width = WIN_XSIZE, height = WIN_YSIZE;
+  const int width = video.width, height = video.height;
 
+#if 0
 #if !defined(PLATFORM_MSDOS)
   static struct IconFileInfo icon_pic =
   {
     "rocks_icon.xbm",
     "rocks_iconmask.xbm"
   };
+#endif
 #endif
 
   screen_width = XDisplayWidth(display, screen);
@@ -121,21 +150,25 @@ static DrawWindow X11InitWindow()
     XChangeProperty(display, window, proto_atom, XA_ATOM, 32,
                    PropModePrepend, (unsigned char *) &delete_atom, 1);
 
+#if 0
   sprintf(icon_filename, "%s/%s/%s",
          options.ro_base_directory, GRAPHICS_DIRECTORY,
          icon_pic.picture_filename);
-  XReadBitmapFile(display,window,icon_filename,
-                 &icon_width,&icon_height,
-                 &icon_pixmap,&icon_hot_x,&icon_hot_y);
+#endif
+  XReadBitmapFile(display, window, program.x11_icon_filename,
+                 &icon_width, &icon_height,
+                 &icon_pixmap, &icon_hot_x, &icon_hot_y);
   if (!icon_pixmap)
     Error(ERR_EXIT, "cannot read icon bitmap file '%s'", icon_filename);
 
+#if 0
   sprintf(icon_filename, "%s/%s/%s",
          options.ro_base_directory, GRAPHICS_DIRECTORY,
          icon_pic.picturemask_filename);
-  XReadBitmapFile(display,window,icon_filename,
-                 &icon_width,&icon_height,
-                 &iconmask_pixmap,&icon_hot_x,&icon_hot_y);
+#endif
+  XReadBitmapFile(display, window, program.x11_iconmask_filename,
+                 &icon_width, &icon_height,
+                 &iconmask_pixmap, &icon_hot_x, &icon_hot_y);
   if (!iconmask_pixmap)
     Error(ERR_EXIT, "cannot read icon bitmap file '%s'", icon_filename);
 
@@ -162,8 +195,8 @@ static DrawWindow X11InitWindow()
   wm_hints.icon_mask = iconmask_pixmap;
   wm_hints.flags = StateHint | IconPixmapHint | IconMaskHint | InputHint;
 
-  class_hints.res_name = program_name;
-  class_hints.res_class = "Rocks'n'Diamonds";
+  class_hints.res_name = program.command_name;
+  class_hints.res_class = program.program_title;
 
   XSetWMProperties(display, window, &windowName, &iconName, 
                   NULL, 0, &size_hints, &wm_hints, 
@@ -191,17 +224,4 @@ static DrawWindow X11InitWindow()
   return window;
 }
 
-inline void X11InitBufferedDisplay(DrawBuffer *backbuffer, DrawWindow *window)
-{
-  X11InitDisplay();
-  *window = X11InitWindow();
-
-  XMapWindow(display, *window);
-  FlushDisplay();
-
-  /* create additional buffer for double-buffering */
-  *backbuffer = CreateBitmap(WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH);
-  pix[PIX_DB_BACK] = *backbuffer;      /* 'backbuffer' is off-screen buffer */
-}
-
 #endif /* TARGET_X11 */
index ca1247c50bc0a2c1459ae6eba6b1186d6e0b96a6..783deb3ebb5c10dfd458450b100260875cbfaa4c 100644 (file)
@@ -268,6 +268,7 @@ typedef XClientMessageEvent ClientMessageEvent;
 
 /* X11 function definitions */
 
-inline void X11InitBufferedDisplay(DrawBuffer *, DrawWindow *);
+inline void X11InitVideoDisplay(void);
+inline void X11InitVideoBuffer(DrawBuffer *, DrawWindow *);
 
 #endif /* X11_H */
index c53408b2bebfa103bed1c7581fa3d6f4c00f2b89..9eb316c2e5635706f9489b41faae740af75d3100 100644 (file)
 #define PIX_SMALLFONT          8
 #define PIX_MEDIUMFONT         9
 /* Bitmaps without graphic file */
-#define PIX_DB_BACK            10
-#define PIX_DB_DOOR            11
-#define PIX_DB_FIELD           12
+#define PIX_DB_DOOR            10
+#define PIX_DB_FIELD           11
 
 #define NUM_PICTURES           10
-#define NUM_BITMAPS            13
+#define NUM_BITMAPS            12
 
 /* boundaries of arrays etc. */
 #define MAX_PLAYER_NAME_LEN    10
@@ -1666,6 +1665,7 @@ extern int                num_element_info;
 #define PROGRAM_IDENT_STRING   PROGRAM_VERSION_STRING " " TARGET_STRING
 #define WINDOW_TITLE_STRING    PROGRAM_TITLE_STRING " " PROGRAM_IDENT_STRING
 #define WINDOW_SUBTITLE_STRING PROGRAM_RIGHTS_STRING " " PROGRAM_AUTHOR_STRING
+#define ICON_TITLE_STRING      PROGRAM_TITLE_STRING
 
 /* default name for empty highscore entry */
 #define EMPTY_PLAYER_NAME      "no name"