void InitGfx()
{
- int i, j;
+ int i;
-#if defined(TARGET_SDL)
- SDL_Surface *sdl_image_tmp;
-#else
+#if defined(TARGET_X11)
GC copy_clipmask_gc;
XGCValues clip_gc_values;
unsigned long clip_gc_valuemask;
};
#endif
+#ifdef TARGET_X11
static struct
{
int start;
{ GFX2_SHIELD_ACTIVE, 3 },
{ -1, 0 }
};
+#endif
/* initialize playfield properties */
#if defined(TARGET_SDL)
+#if 0
/* initialize surface array to 'NULL' */
for(i=0; i<NUM_TILES; i++)
tile_masked[i] = NULL;
{
for(j=0; j<tile_needs_clipping[i].count; j++)
{
+ SDL_Surface *sdl_image_tmp;
int tile = tile_needs_clipping[i].start + j;
int graphic = tile;
int src_x, src_y;
Bitmap src_bitmap;
getGraphicSource(graphic, &bitmap_nr, &src_x, &src_y);
- src_bitmap = pix_masked[bitmap_nr];
+ src_bitmap = pix[bitmap_nr];
/* create surface for masked tile graphic */
if ((sdl_image_tmp = SDL_CreateRGBSurface(SDL_SWSURFACE, TILEX, TILEY,
BlitBitmap(src_bitmap, tile_masked[tile], src_x,src_y, TILEX,TILEY, 0,0);
}
}
+#endif
#else /* !TARGET_SDL */
/* create only those clipping Pixmaps we really need */
for(i=0; tile_needs_clipping[i].start>=0; i++)
{
+ int j;
+
for(j=0; j<tile_needs_clipping[i].count; j++)
{
int tile = tile_needs_clipping[i].start + j;
Error(ERR_EXIT, "IMG_Load() failed: %s", SDL_GetError());
/* create native non-transparent surface for current image */
- if ((pix[pos] = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
+ if ((pix[pos]->surface = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s", SDL_GetError());
/* create native transparent surface for current image */
SDL_SetColorKey(sdl_image_tmp, SDL_SRCCOLORKEY,
SDL_MapRGB(sdl_image_tmp->format, 0x00, 0x00, 0x00));
- if ((pix_masked[pos] = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
+ if ((pix[pos]->surface_masked = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s", SDL_GetError());
/* free temporary surface */
free(gcv);
}
+void XUnmapWindow(Display *display, Window window)
+{
+}
+
void XCloseDisplay(Display *display)
{
BITMAP *bitmap = video_bitmap;
{
}
+void XDestroyWindow(Display *display, Window window)
+{
+}
+
Bool XQueryPointer(Display *display, Window window,
Window *root, Window *child, int *root_x, int *root_y,
int *win_x, int *win_y, unsigned int *mask)
/* symbol 'window' is defined in DJGPP cross-compiler in libc.a(conio.o) */
#define window window_djgpp
+/* symbol 'font' is defined in "allegro.h" */
+#define font font_allegro
+
/* system dependent definitions */
#define TARGET_STRING "DOS"
unsigned int *, unsigned int *, Pixmap *, int *, int *);
void XFreePixmap(Display *, Pixmap);
void XFreeGC(Display *, GC);
+void XUnmapWindow(Display *, Window);
void XCloseDisplay(Display *);
void XNextEvent(Display *, XEvent *);
int XPending(Display *);
void XSetForeground(Display *, GC, unsigned long);
void XDrawLine(Display *, Drawable, GC, int, int, int, int);
void XDestroyImage(XImage *);
+void XDestroyWindow(Display *, Window);
Bool XQueryPointer(Display *, Window, Window *, Window *, int *, int *,
int *, int *, unsigned int *);
void XAutoRepeatOn(Display *);
{
/* 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());
else
{
if (window_old)
- SDL_FreeSurface(window_old);
+ FreeBitmap(window_old);
*backbuffer = window_new;
video.fullscreen_enabled = TRUE;
{
/* 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());
else
{
if (window_old)
- SDL_FreeSurface(window_old);
+ FreeBitmap(window_old);
*backbuffer = window_new;
video.fullscreen_enabled = FALSE;
#define FULLSCREEN_STATUS FULLSCREEN_AVAILABLE
-/* structure definitions */
-
-struct SDLSurfaceInfo
-{
- SDL_Surface *surface;
- SDL_Surface *surface_masked;
-};
-
-
/* SDL type definitions */
typedef struct SDLSurfaceInfo *Bitmap;
typedef int Colormap;
+/* structure definitions */
+
+struct SDLSurfaceInfo
+{
+ SDL_Surface *surface;
+ SDL_Surface *surface_masked;
+ GC gc;
+ GC stored_clip_gc;
+};
+
+
/* SDL symbol definitions */
#define None 0L
if (!(pixmap = XCreatePixmap(display, window->drawable,
width, height, real_depth)))
Error(ERR_EXIT, "cannot create pixmap");
-
new_bitmap->drawable = pixmap;
-#endif
if (window == NULL)
Error(ERR_EXIT, "Window GC needed for Bitmap -- create Window first");
new_bitmap->gc = window->gc;
+#endif
+
return new_bitmap;
}
int to_x, int to_y)
{
#ifdef TARGET_SDL
- SDLDrawSimpleLine(bitmap->drawable, from_x, from_y, to_x, to_y, 0xffffff);
+ SDLDrawSimpleLine(bitmap->surface, 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);
#include "libgame.h"
-#if 1
-#include "main_TMP.h"
-#endif
-
/* ========================================================================= */
/* exported variables */
#define FULLSCREEN_STATUS FULLSCREEN_NOT_AVAILABLE
-/* structure definitions */
-
-struct X11DrawableInfo
-{
- Drawable drawable;
- Drawable clip_mask;
- GC gc; /* GC for normal drawing (inheritated from 'window') */
- GC stored_clip_gc; /* GC for masked drawing (used for whole Pixmap) */
- GC clip_gc; /* can be 'stored_clip_gc' or one-tile-only clip GC */
-};
-
-
/* X11 type definitions */
typedef struct X11DrawableInfo *Bitmap;
typedef XClientMessageEvent ClientMessageEvent;
+/* structure definitions */
+
+struct X11DrawableInfo
+{
+ Drawable drawable;
+ Drawable clip_mask;
+ GC gc; /* GC for normal drawing (inheritated from 'window') */
+ GC stored_clip_gc; /* GC for masked drawing (used for whole Pixmap) */
+ GC clip_gc; /* can be 'stored_clip_gc' or one-tile-only clip GC */
+};
+
+
/* X11 symbol definitions */
#define EVENT_BUTTONPRESS ButtonPress
Bitmap pix[NUM_BITMAPS];
#if 0
Bitmap pix_masked[NUM_BITMAPS];
-#endif
+
Bitmap tile_masked[NUM_TILES];
-#if 0
+
Pixmap clipmask[NUM_BITMAPS];
#endif
Pixmap tile_clipmask[NUM_TILES];
+#if 0
+
/* +-----------------------------------------------------------------------+ */
/* | SDL TEST STUFF | */
/* +-----------------------------------------------------------------------+ */
/* | SDL TEST STUFF | */
/* +-----------------------------------------------------------------------+ */
+#endif
+
int main(int argc, char *argv[])
extern Bitmap pix[];
#if 0
extern Bitmap pix_masked[];
-#endif
+
extern Bitmap tile_masked[];
-#if 0
+
extern Pixmap clipmask[];
#endif
extern Pixmap tile_clipmask[];