+ /* SDL cannot directly draw to the visible video framebuffer like X11,
+ but always uses a backbuffer, which is then blitted to the visible
+ video framebuffer with 'SDL_UpdateRect' (or replaced with the current
+ visible video framebuffer with 'SDL_Flip', if the hardware supports
+ this). Therefore do not use an additional backbuffer for drawing, but
+ use a symbolic buffer (distinguishable from the SDL backbuffer) called
+ 'window', which indicates that the SDL backbuffer should be updated to
+ the visible video framebuffer when attempting to blit to it.
+
+ For convenience, it seems to be a good idea to create this symbolic
+ 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 */
+
+#else /* !USE_SDL_LIBRARY */
+
+ pix[PIX_DB_BACK] = XCreatePixmap(display, window,
+ WIN_XSIZE,WIN_YSIZE,
+ XDefaultDepth(display,screen));
+ pix[PIX_DB_DOOR] = XCreatePixmap(display, window,
+ 3*DXSIZE,DYSIZE+VYSIZE,
+ XDefaultDepth(display,screen));
+ pix[PIX_DB_FIELD] = XCreatePixmap(display, window,
+ FXSIZE,FYSIZE,
+ XDefaultDepth(display,screen));
+
+ if (!pix[PIX_DB_BACK] || !pix[PIX_DB_DOOR] || !pix[PIX_DB_FIELD])
+ Error(ERR_EXIT, "cannot create additional pixmaps");
+
+#endif /* !USE_SDL_LIBRARY */
+
+#if DEBUG_TIMING
+ debug_print_timestamp(0, NULL); /* initialize timestamp function */
+#endif
+
+#ifdef DEBUG
+#if 0
+ printf("Test: Loading RocksFont2.pcx ...\n");
+ LoadGfx(PIX_SMALLFONT,&test_pic1);
+ printf("Test: Done.\n");
+ printf("Test: Loading mouse.pcx ...\n");
+ LoadGfx(PIX_SMALLFONT,&test_pic2);
+ printf("Test: Done.\n");
+#endif
+#endif
+
+ LoadGfx(PIX_SMALLFONT, &pic[PIX_SMALLFONT]);
+ DrawInitText(WINDOW_TITLE_STRING, 20, FC_YELLOW);
+ DrawInitText(WINDOW_SUBTITLE_STRING, 50, FC_RED);
+#ifdef MSDOS
+ DrawInitText(PROGRAM_DOS_PORT_STRING, 210, FC_BLUE);
+ rest(200);
+#endif /* MSDOS */
+ DrawInitText("Loading graphics:",120,FC_GREEN);
+
+ for(i=0; i<NUM_PICTURES; i++)
+ if (i != PIX_SMALLFONT)
+ LoadGfx(i,&pic[i]);
+
+#if DEBUG_TIMING
+ debug_print_timestamp(0, "SUMMARY LOADING ALL GRAPHICS:");
+#endif
+
+ /* create additional image buffers for masking of graphics */
+
+#ifdef USE_SDL_LIBRARY
+