From: Holger Schemel Date: Sat, 22 Jul 2000 00:10:25 +0000 (+0200) Subject: rnd-20000722-1-src X-Git-Tag: 2.0.0^2~53 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=52189f4b3b797e08699f67880198b585320cf8bf;p=rocksndiamonds.git rnd-20000722-1-src --- diff --git a/src/Makefile b/src/Makefile index ef2154ba..f1e51133 100644 --- a/src/Makefile +++ b/src/Makefile @@ -35,10 +35,23 @@ EXTRA_LIBS = -lnsl -lsocket -R$(XLIB_PATH) endif SDL_CFLAGS := -DUSE_SDL_LIBRARY $(shell sdl-config --cflags) -SDL_LDFLAGS := -lIMG $(shell sdl-config --libs) +SDL_LDFLAGS := -lSDL_image $(shell sdl-config --libs) -INCL = $(X11_INCL) -LIBS = $(X11_LIBS) -lX11 -lm $(EXTRA_LIBS) $(SDL_LDFLAGS) +X11_CFLAGS = $(X11_INCL) +X11_LDFLAGS = $(X11_LIBS) -lX11 + +USE_SDL = true + +ifdef USE_SDL +SYS_CFLAGS = $(SDL_CFLAGS) +SYS_LDFLAGS = $(SDL_LDFLAGS) +else +SYS_CFLAGS = $(X11_CFLAGS) +SYS_LDFLAGS = $(X11_LDFLAGS) +endif + +INCL = $(SYS_CFLAGS) +LIBS = $(SYS_LDFLAGS) $(EXTRA_LIBS) -lm endif @@ -66,9 +79,9 @@ OPTIONS = -DDEBUG -g -Wall # only for debugging purposes # OPTIONS = -O3 -Wall # OPTIONS = -O3 -# SYSTEM = -DSYSV -Ae # may be needed for HP-UX +# SYSTEM = -DSYSV -Ae # may be needed for HP-UX -CFLAGS = $(OPTIONS) $(SDL_CFLAGS) $(SYSTEM) $(INCL) $(CONFIG) +CFLAGS = $(OPTIONS) $(SYSTEM) $(SYS_CFLAGS) $(CONFIG) SRCS = main.c \ init.c \ @@ -91,6 +104,7 @@ SRCS = main.c \ netserv.c \ msdos.c \ system.c \ + x11.c \ sdl.c OBJS = main.o \ @@ -114,12 +128,13 @@ OBJS = main.o \ netserv.o \ msdos.o \ system.o \ + x11.o \ sdl.o all: $(PROGNAME) $(PROGNAME): $(OBJS) - $(CC) $(CFLAGS) $(OBJS) $(LIBS) -o $(PROGNAME) + $(CC) $(OBJS) $(LIBS) -o $(PROGNAME) .c.o: $(CC) $(CFLAGS) -c $*.c diff --git a/src/events.c b/src/events.c index 85ae4d61..a2b346c0 100644 --- a/src/events.c +++ b/src/events.c @@ -176,6 +176,7 @@ void SleepWhileUnmapped() void HandleExposeEvent(ExposeEvent *event) { +#ifndef USE_SDL_LIBRARY int x = event->x, y = event->y; int width = event->width, height = event->height; @@ -209,6 +210,7 @@ void HandleExposeEvent(ExposeEvent *event) BlitBitmap(drawto, window, x,y, width,height, x,y); FlushDisplay(); +#endif } void HandleButtonEvent(ButtonEvent *event) diff --git a/src/files.c b/src/files.c index d04e0fb2..9870c828 100644 --- a/src/files.c +++ b/src/files.c @@ -14,7 +14,6 @@ #include #include #include -#include #include "files.h" #include "tools.h" diff --git a/src/image.c b/src/image.c index 83d8216b..a3f92570 100644 --- a/src/image.c +++ b/src/image.c @@ -11,6 +11,8 @@ * image.c * ***********************************************************/ +#ifndef USE_SDL_LIBRARY + #include "image.h" #include "pcx.h" #include "misc.h" @@ -551,4 +553,5 @@ int Read_PCX_to_Pixmap(Display *display, Window window, GC gc, char *filename, return PCX_Success; } +#endif /* !USE_SDL_LIBRARY */ #endif /* !MSDOS */ diff --git a/src/image.h b/src/image.h index 6315340e..d05b63c6 100644 --- a/src/image.h +++ b/src/image.h @@ -14,6 +14,8 @@ #ifndef IMAGE_H #define IMAGE_H +#ifndef USE_SDL_LIBRARY + #include "main.h" #define MAX_COLORS 256 /* maximal number of colors for each image */ @@ -55,4 +57,6 @@ Image *newImage(unsigned int, unsigned int, unsigned int); void freeImage(Image *); void freeXImage(Image *, XImageInfo *); +#endif /* !USE_SDL_LIBRARY */ + #endif /* IMAGE_H */ diff --git a/src/main.h b/src/main.h index f808f754..b21ac5d6 100644 --- a/src/main.h +++ b/src/main.h @@ -17,30 +17,12 @@ #include #include #include +#include #include #include #include - -#ifndef MSDOS -#define XK_MISCELLANY -#define XK_LATIN1 - -/* -#include -#include -#include -#include -#include -#include -*/ - -#ifdef XPM_INCLUDE_FILE -#define USE_XPM_LIBRARY -#include XPM_INCLUDE_FILE -#endif -#else /* MSDOS */ -#include "msdos.h" -#endif /* MSDOS */ +#include +#include #ifdef DEBUG #define DEBUG_TIMING 0 diff --git a/src/misc.c b/src/misc.c index 5e4dc358..211108d0 100644 --- a/src/misc.c +++ b/src/misc.c @@ -12,7 +12,6 @@ ***********************************************************/ #include -#include #include #include #include diff --git a/src/netserv.c b/src/netserv.c index a9ffa6a7..ac142763 100644 --- a/src/netserv.c +++ b/src/netserv.c @@ -13,7 +13,6 @@ #ifndef MSDOS -#include #include #include #include diff --git a/src/network.c b/src/network.c index 1c593270..5534c56f 100644 --- a/src/network.c +++ b/src/network.c @@ -13,7 +13,6 @@ #ifndef MSDOS -#include #include #include #include diff --git a/src/pcx.c b/src/pcx.c index b26e4427..a3bdf3bd 100644 --- a/src/pcx.c +++ b/src/pcx.c @@ -11,6 +11,8 @@ * pcx.c * ***********************************************************/ +#ifndef USE_SDL_LIBRARY + #include "pcx.h" #include "image.h" #include "misc.h" @@ -259,3 +261,5 @@ Image *Read_PCX_to_Image(char *filename) return image; } + +#endif /* !USE_SDL_LIBRARY */ diff --git a/src/pcx.h b/src/pcx.h index 44217edd..45fc251b 100644 --- a/src/pcx.h +++ b/src/pcx.h @@ -14,6 +14,8 @@ #ifndef PCX_H #define PCX_H +#ifndef USE_SDL_LIBRARY + #include "main.h" #include "image.h" @@ -29,4 +31,6 @@ extern int errno_pcx; Image *Read_PCX_to_Image(char *); +#endif /* !USE_SDL_LIBRARY */ + #endif /* PCX_H */ diff --git a/src/sdl.c b/src/sdl.c index 3f193013..bcebf7f2 100644 --- a/src/sdl.c +++ b/src/sdl.c @@ -53,6 +53,7 @@ inline void SDLFillRectangle(SDL_Surface *surface, int x, int y, SDL_FillRect(surface, &rect, SDL_MapRGB(surface->format, color_r, color_g, color_b)); + SDL_UpdateRect(surface, x, y, width, height); } inline void SDLDrawSimpleLine(SDL_Surface *surface, int from_x, int from_y, diff --git a/src/sdl.h b/src/sdl.h index dfe39e50..69d2f20b 100644 --- a/src/sdl.h +++ b/src/sdl.h @@ -16,10 +16,273 @@ #define SDL_H #include "SDL.h" -#include "IMG.h" +#include "SDL_image.h" + + +/* SDL type definitions */ + +typedef SDL_Surface *Bitmap; +typedef SDL_Surface *DrawWindow; +typedef SDL_Surface *DrawBuffer; + +typedef SDLKey Key; + +typedef SDL_Event Event; +typedef SDL_MouseButtonEvent ButtonEvent; +typedef SDL_MouseMotionEvent MotionEvent; +typedef SDL_KeyboardEvent KeyEvent; +typedef SDL_Event ExposeEvent; +typedef SDL_Event FocusChangeEvent; +typedef SDL_Event ClientMessageEvent; + +typedef int GC; +typedef int Pixmap; +typedef int Display; +typedef int Visual; +typedef int Colormap; + + +/* SDL symbol definitions */ + +#define None 0L + +#define EVENT_BUTTONPRESS SDL_MOUSEBUTTONDOWN +#define EVENT_BUTTONRELEASE SDL_MOUSEBUTTONUP +#define EVENT_MOTIONNOTIFY SDL_MOUSEMOTION +#define EVENT_KEYPRESS SDL_KEYDOWN +#define EVENT_KEYRELEASE SDL_KEYUP +#define EVENT_EXPOSE SDL_USEREVENT + 0 +#define EVENT_FOCUSIN SDL_USEREVENT + 1 +#define EVENT_FOCUSOUT SDL_USEREVENT + 2 +#define EVENT_CLIENTMESSAGE SDL_QUIT +#define EVENT_MAPNOTIFY SDL_USEREVENT + 4 +#define EVENT_UNMAPNOTIFY SDL_USEREVENT + 5 + +#define KEY_UNDEFINED SDLK_UNKNOWN + +#define KEY_Return SDLK_RETURN +#define KEY_Escape SDLK_ESCAPE + +#define KEY_Left SDLK_LEFT +#define KEY_Right SDLK_RIGHT +#define KEY_Up SDLK_UP +#define KEY_Down SDLK_DOWN + +#ifdef SDLK_KP_LEFT +#define KEY_KP_Left SDLK_KP_LEFT +#define KEY_KP_Right SDLK_KP_RIGHT +#define KEY_KP_Up SDLK_KP_UP +#define KEY_KP_Down SDLK_KP_DOWN +#endif + +#define KEY_KP_Enter SDLK_KP_ENTER +#define KEY_KP_Add SDLK_KP_PLUS +#define KEY_KP_Subtract SDLK_KP_MINUS +#define KEY_KP_Multiply SDLK_KP_MULTIPLY +#define KEY_KP_Divide SDLK_KP_DIVIDE +#define KEY_KP_Separator SDLK_KP_PERIOD + +#define KEY_Shift_L SDLK_LSHIFT +#define KEY_Shift_R SDLK_RSHIFT +#define KEY_Control_L SDLK_LCTRL +#define KEY_Control_R SDLK_RCTRL +#define KEY_Meta_L SDLK_LMETA +#define KEY_Meta_R SDLK_RMETA +#define KEY_Alt_L SDLK_LALT +#define KEY_Alt_R SDLK_RALT +#define KEY_Mode_switch SDLK_MODE +#define KEY_Multi_key KEY_UNDEFINED /* undefined */ + +#define KEY_BackSpace SDLK_BACKSPACE +#define KEY_Delete SDLK_DELETE +#define KEY_Insert SDLK_INSERT +#define KEY_Tab SDLK_TAB +#define KEY_Home SDLK_HOME +#define KEY_End SDLK_END +#define KEY_Page_Up SDLK_PAGEUP +#define KEY_Page_Down SDLK_PAGEDOWN + +#define KEY_space SDLK_SPACE +#define KEY_exclam SDLK_EXCLAIM +#define KEY_quotedbl SDLK_QUOTEDBL +#define KEY_numbersign SDLK_HASH +#define KEY_dollar SDLK_DOLLAR +#define KEY_percent KEY_UNDEFINED /* undefined */ +#define KEY_ampersand SDLK_AMPERSAND +#define KEY_apostrophe SDLK_QUOTE +#define KEY_parenleft SDLK_LEFTPAREN +#define KEY_parenright SDLK_RIGHTPAREN +#define KEY_asterisk SDLK_ASTERISK +#define KEY_plus SDLK_PLUS +#define KEY_comma SDLK_COMMA +#define KEY_minus SDLK_MINUS +#define KEY_period SDLK_PERIOD +#define KEY_slash SDLK_SLASH + +#define KEY_colon SDLK_COLON +#define KEY_semicolon SDLK_SEMICOLON +#define KEY_less SDLK_LESS +#define KEY_equal SDLK_EQUALS +#define KEY_greater SDLK_GREATER +#define KEY_question SDLK_QUESTION +#define KEY_at SDLK_AT + +#define KEY_bracketleft SDLK_LEFTBRACKET +#define KEY_backslash SDLK_BACKSLASH +#define KEY_bracketright SDLK_RIGHTBRACKET +#define KEY_asciicircum SDLK_CARET +#define KEY_underscore SDLK_UNDERSCORE +#define KEY_grave SDLK_BACKQUOTE + +#define KEY_quoteleft KEY_UNDEFINED /* undefined */ +#define KEY_braceleft KEY_UNDEFINED /* undefined */ +#define KEY_bar KEY_UNDEFINED /* undefined */ +#define KEY_braceright KEY_UNDEFINED /* undefined */ +#define KEY_asciitilde KEY_UNDEFINED /* undefined */ + +#define KEY_Adiaeresis SDLK_WORLD_36 +#define KEY_Odiaeresis SDLK_WORLD_54 +#define KEY_Udiaeresis SDLK_WORLD_60 +#define KEY_adiaeresis SDLK_WORLD_68 +#define KEY_odiaeresis SDLK_WORLD_86 +#define KEY_udiaeresis SDLK_WORLD_92 +#define KEY_ssharp SDLK_WORLD_63 + +#ifndef SDLK_A +#define SDLK_A 65 +#define SDLK_B 66 +#define SDLK_C 67 +#define SDLK_D 68 +#define SDLK_E 69 +#define SDLK_F 70 +#define SDLK_G 71 +#define SDLK_H 72 +#define SDLK_I 73 +#define SDLK_J 74 +#define SDLK_K 75 +#define SDLK_L 76 +#define SDLK_M 77 +#define SDLK_N 78 +#define SDLK_O 79 +#define SDLK_P 80 +#define SDLK_Q 81 +#define SDLK_R 82 +#define SDLK_S 83 +#define SDLK_T 84 +#define SDLK_U 85 +#define SDLK_V 86 +#define SDLK_W 87 +#define SDLK_X 88 +#define SDLK_Y 89 +#define SDLK_Z 90 +#endif + +#define KEY_A SDLK_A +#define KEY_B SDLK_B +#define KEY_C SDLK_C +#define KEY_D SDLK_D +#define KEY_E SDLK_E +#define KEY_F SDLK_F +#define KEY_G SDLK_G +#define KEY_H SDLK_H +#define KEY_I SDLK_I +#define KEY_J SDLK_J +#define KEY_K SDLK_K +#define KEY_L SDLK_L +#define KEY_M SDLK_M +#define KEY_N SDLK_N +#define KEY_O SDLK_O +#define KEY_P SDLK_P +#define KEY_Q SDLK_Q +#define KEY_R SDLK_R +#define KEY_S SDLK_S +#define KEY_T SDLK_T +#define KEY_U SDLK_U +#define KEY_V SDLK_V +#define KEY_W SDLK_W +#define KEY_X SDLK_X +#define KEY_Y SDLK_Y +#define KEY_Z SDLK_Z + +#define KEY_a SDLK_a +#define KEY_b SDLK_b +#define KEY_c SDLK_c +#define KEY_d SDLK_d +#define KEY_e SDLK_e +#define KEY_f SDLK_f +#define KEY_g SDLK_g +#define KEY_h SDLK_h +#define KEY_i SDLK_i +#define KEY_j SDLK_j +#define KEY_k SDLK_k +#define KEY_l SDLK_l +#define KEY_m SDLK_m +#define KEY_n SDLK_n +#define KEY_o SDLK_o +#define KEY_p SDLK_p +#define KEY_q SDLK_q +#define KEY_r SDLK_r +#define KEY_s SDLK_s +#define KEY_t SDLK_t +#define KEY_u SDLK_u +#define KEY_v SDLK_v +#define KEY_w SDLK_w +#define KEY_x SDLK_x +#define KEY_y SDLK_y +#define KEY_z SDLK_z + +#define KEY_0 SDLK_0 +#define KEY_1 SDLK_1 +#define KEY_2 SDLK_2 +#define KEY_3 SDLK_3 +#define KEY_4 SDLK_4 +#define KEY_5 SDLK_5 +#define KEY_6 SDLK_6 +#define KEY_7 SDLK_7 +#define KEY_8 SDLK_8 +#define KEY_9 SDLK_9 + +#define KEY_KP_0 SDLK_KP0 +#define KEY_KP_1 SDLK_KP1 +#define KEY_KP_2 SDLK_KP2 +#define KEY_KP_3 SDLK_KP3 +#define KEY_KP_4 SDLK_KP4 +#define KEY_KP_5 SDLK_KP5 +#define KEY_KP_6 SDLK_KP6 +#define KEY_KP_7 SDLK_KP7 +#define KEY_KP_8 SDLK_KP8 +#define KEY_KP_9 SDLK_KP9 + +#define KEY_F1 SDLK_F1 +#define KEY_F2 SDLK_F2 +#define KEY_F3 SDLK_F3 +#define KEY_F4 SDLK_F4 +#define KEY_F5 SDLK_F5 +#define KEY_F6 SDLK_F6 +#define KEY_F7 SDLK_F7 +#define KEY_F8 SDLK_F8 +#define KEY_F9 SDLK_F9 +#define KEY_F10 SDLK_F10 +#define KEY_F11 SDLK_F11 +#define KEY_F12 SDLK_F12 +#define KEY_F13 SDLK_F13 +#define KEY_F14 SDLK_F14 +#define KEY_F15 SDLK_F15 +#define KEY_F16 KEY_UNDEFINED +#define KEY_F17 KEY_UNDEFINED +#define KEY_F18 KEY_UNDEFINED +#define KEY_F19 KEY_UNDEFINED +#define KEY_F20 KEY_UNDEFINED +#define KEY_F21 KEY_UNDEFINED +#define KEY_F22 KEY_UNDEFINED +#define KEY_F23 KEY_UNDEFINED +#define KEY_F24 KEY_UNDEFINED + + +/* SDL function definitions */ inline void SDLCopyArea(SDL_Surface *, SDL_Surface *, - int, int, int, int, int, int); + int, int, int, int, int, int); inline void SDLFillRectangle(SDL_Surface *, int, int, int, int, unsigned int); inline void SDLDrawSimpleLine(SDL_Surface *, int, int, int, int, unsigned int); diff --git a/src/system.c b/src/system.c index 5fbf9efe..3c182357 100644 --- a/src/system.c +++ b/src/system.c @@ -14,10 +14,6 @@ #include "main.h" -#ifdef USE_SDL_LIBRARY -#include "sdl.h" -#endif - inline void ClearRectangle(Bitmap bitmap, int x, int y, int width, int height) { #ifdef USE_SDL_LIBRARY @@ -162,20 +158,11 @@ inline void NextEvent(Event *event) inline Key GetEventKey(KeyEvent *event, boolean with_modifiers) { #ifdef USE_SDL_LIBRARY -#if 0 - printf("0x%x, 0x%x\n", - event->keysym.sym, event->keysym.unicode); -#endif if (with_modifiers && event->keysym.unicode != 0) return event->keysym.unicode; else return event->keysym.sym; #else -#if 0 - printf("0x%x, 0x%x\n", - (unsigned int)XLookupKeysym(event, 0), - (unsigned int)XLookupKeysym(event, event->state)); -#endif if (with_modifiers) return XLookupKeysym(event, event->state); else diff --git a/src/system.h b/src/system.h index e2dfca6e..01f5afe8 100644 --- a/src/system.h +++ b/src/system.h @@ -15,488 +15,23 @@ #ifndef SYSTEM_H #define SYSTEM_H -#ifndef MSDOS -#include -#include -#include -#include -#include -#include +#if !defined(USE_SDL_LIBRARY) +#define USE_X11_LIBRARY #endif -#ifdef USE_SDL_LIBRARY -#include "sdl.h" +#if defined(XPM_INCLUDE_FILE) && !defined(MSDOS) +#define USE_XPM_LIBRARY +#include XPM_INCLUDE_FILE #endif -#ifdef USE_SDL_LIBRARY - -typedef SDL_Surface *Bitmap; -typedef SDL_Surface *DrawWindow; -typedef SDL_Surface *DrawBuffer; - -typedef SDLKey Key; - -typedef SDL_Event Event; -typedef SDL_MouseButtonEvent ButtonEvent; -typedef SDL_MouseMotionEvent MotionEvent; -typedef SDL_KeyboardEvent KeyEvent; -typedef XExposeEvent ExposeEvent; -typedef XFocusChangeEvent FocusChangeEvent; -typedef XClientMessageEvent ClientMessageEvent; - -#define EVENT_BUTTONPRESS SDL_MOUSEBUTTONDOWN -#define EVENT_BUTTONRELEASE SDL_MOUSEBUTTONUP -#define EVENT_MOTIONNOTIFY SDL_MOUSEMOTION -#define EVENT_KEYPRESS SDL_KEYDOWN -#define EVENT_KEYRELEASE SDL_KEYUP -#define EVENT_EXPOSE SDL_USEREVENT + 0 -#define EVENT_FOCUSIN SDL_USEREVENT + 1 -#define EVENT_FOCUSOUT SDL_USEREVENT + 2 -#define EVENT_CLIENTMESSAGE SDL_QUIT -#define EVENT_MAPNOTIFY SDL_USEREVENT + 4 -#define EVENT_UNMAPNOTIFY SDL_USEREVENT + 5 - -#define KEY_UNDEFINED SDLK_UNKNOWN - -#define KEY_Return SDLK_RETURN -#define KEY_Escape SDLK_ESCAPE - -#define KEY_Left SDLK_LEFT -#define KEY_Right SDLK_RIGHT -#define KEY_Up SDLK_UP -#define KEY_Down SDLK_DOWN - -#ifdef SDLK_KP_LEFT -#define KEY_KP_Left SDLK_KP_LEFT -#define KEY_KP_Right SDLK_KP_RIGHT -#define KEY_KP_Up SDLK_KP_UP -#define KEY_KP_Down SDLK_KP_DOWN +#if defined(MSDOS) +#include "msdos.h" #endif -#define KEY_KP_Enter SDLK_KP_ENTER -#define KEY_KP_Add SDLK_KP_PLUS -#define KEY_KP_Subtract SDLK_KP_MINUS -#define KEY_KP_Multiply SDLK_KP_MULTIPLY -#define KEY_KP_Divide SDLK_KP_DIVIDE -#define KEY_KP_Separator SDLK_KP_PERIOD - -#define KEY_Shift_L SDLK_LSHIFT -#define KEY_Shift_R SDLK_RSHIFT -#define KEY_Control_L SDLK_LCTRL -#define KEY_Control_R SDLK_RCTRL -#define KEY_Meta_L SDLK_LMETA -#define KEY_Meta_R SDLK_RMETA -#define KEY_Alt_L SDLK_LALT -#define KEY_Alt_R SDLK_RALT -#define KEY_Mode_switch SDLK_MODE -#define KEY_Multi_key KEY_UNDEFINED /* undefined */ - -#define KEY_BackSpace SDLK_BACKSPACE -#define KEY_Delete SDLK_DELETE -#define KEY_Insert SDLK_INSERT -#define KEY_Tab SDLK_TAB -#define KEY_Home SDLK_HOME -#define KEY_End SDLK_END -#define KEY_Page_Up SDLK_PAGEUP -#define KEY_Page_Down SDLK_PAGEDOWN - -#define KEY_space SDLK_SPACE -#define KEY_exclam SDLK_EXCLAIM -#define KEY_quotedbl SDLK_QUOTEDBL -#define KEY_numbersign SDLK_HASH -#define KEY_dollar SDLK_DOLLAR -#define KEY_percent KEY_UNDEFINED /* undefined */ -#define KEY_ampersand SDLK_AMPERSAND -#define KEY_apostrophe SDLK_QUOTE -#define KEY_parenleft SDLK_LEFTPAREN -#define KEY_parenright SDLK_RIGHTPAREN -#define KEY_asterisk SDLK_ASTERISK -#define KEY_plus SDLK_PLUS -#define KEY_comma SDLK_COMMA -#define KEY_minus SDLK_MINUS -#define KEY_period SDLK_PERIOD -#define KEY_slash SDLK_SLASH - -#define KEY_colon SDLK_COLON -#define KEY_semicolon SDLK_SEMICOLON -#define KEY_less SDLK_LESS -#define KEY_equal SDLK_EQUALS -#define KEY_greater SDLK_GREATER -#define KEY_question SDLK_QUESTION -#define KEY_at SDLK_AT - -#define KEY_bracketleft SDLK_LEFTBRACKET -#define KEY_backslash SDLK_BACKSLASH -#define KEY_bracketright SDLK_RIGHTBRACKET -#define KEY_asciicircum SDLK_CARET -#define KEY_underscore SDLK_UNDERSCORE -#define KEY_grave SDLK_BACKQUOTE - -#define KEY_quoteleft KEY_UNDEFINED /* undefined */ -#define KEY_braceleft KEY_UNDEFINED /* undefined */ -#define KEY_bar KEY_UNDEFINED /* undefined */ -#define KEY_braceright KEY_UNDEFINED /* undefined */ -#define KEY_asciitilde KEY_UNDEFINED /* undefined */ - -#define KEY_Adiaeresis SDLK_WORLD_36 -#define KEY_Odiaeresis SDLK_WORLD_54 -#define KEY_Udiaeresis SDLK_WORLD_60 -#define KEY_adiaeresis SDLK_WORLD_68 -#define KEY_odiaeresis SDLK_WORLD_86 -#define KEY_udiaeresis SDLK_WORLD_92 -#define KEY_ssharp SDLK_WORLD_63 - -#ifndef SDLK_A -#define SDLK_A 65 -#define SDLK_B 66 -#define SDLK_C 67 -#define SDLK_D 68 -#define SDLK_E 69 -#define SDLK_F 70 -#define SDLK_G 71 -#define SDLK_H 72 -#define SDLK_I 73 -#define SDLK_J 74 -#define SDLK_K 75 -#define SDLK_L 76 -#define SDLK_M 77 -#define SDLK_N 78 -#define SDLK_O 79 -#define SDLK_P 80 -#define SDLK_Q 81 -#define SDLK_R 82 -#define SDLK_S 83 -#define SDLK_T 84 -#define SDLK_U 85 -#define SDLK_V 86 -#define SDLK_W 87 -#define SDLK_X 88 -#define SDLK_Y 89 -#define SDLK_Z 90 -#endif - -#define KEY_A SDLK_A -#define KEY_B SDLK_B -#define KEY_C SDLK_C -#define KEY_D SDLK_D -#define KEY_E SDLK_E -#define KEY_F SDLK_F -#define KEY_G SDLK_G -#define KEY_H SDLK_H -#define KEY_I SDLK_I -#define KEY_J SDLK_J -#define KEY_K SDLK_K -#define KEY_L SDLK_L -#define KEY_M SDLK_M -#define KEY_N SDLK_N -#define KEY_O SDLK_O -#define KEY_P SDLK_P -#define KEY_Q SDLK_Q -#define KEY_R SDLK_R -#define KEY_S SDLK_S -#define KEY_T SDLK_T -#define KEY_U SDLK_U -#define KEY_V SDLK_V -#define KEY_W SDLK_W -#define KEY_X SDLK_X -#define KEY_Y SDLK_Y -#define KEY_Z SDLK_Z - -#define KEY_a SDLK_a -#define KEY_b SDLK_b -#define KEY_c SDLK_c -#define KEY_d SDLK_d -#define KEY_e SDLK_e -#define KEY_f SDLK_f -#define KEY_g SDLK_g -#define KEY_h SDLK_h -#define KEY_i SDLK_i -#define KEY_j SDLK_j -#define KEY_k SDLK_k -#define KEY_l SDLK_l -#define KEY_m SDLK_m -#define KEY_n SDLK_n -#define KEY_o SDLK_o -#define KEY_p SDLK_p -#define KEY_q SDLK_q -#define KEY_r SDLK_r -#define KEY_s SDLK_s -#define KEY_t SDLK_t -#define KEY_u SDLK_u -#define KEY_v SDLK_v -#define KEY_w SDLK_w -#define KEY_x SDLK_x -#define KEY_y SDLK_y -#define KEY_z SDLK_z - -#define KEY_0 SDLK_0 -#define KEY_1 SDLK_1 -#define KEY_2 SDLK_2 -#define KEY_3 SDLK_3 -#define KEY_4 SDLK_4 -#define KEY_5 SDLK_5 -#define KEY_6 SDLK_6 -#define KEY_7 SDLK_7 -#define KEY_8 SDLK_8 -#define KEY_9 SDLK_9 - -#define KEY_KP_0 SDLK_KP0 -#define KEY_KP_1 SDLK_KP1 -#define KEY_KP_2 SDLK_KP2 -#define KEY_KP_3 SDLK_KP3 -#define KEY_KP_4 SDLK_KP4 -#define KEY_KP_5 SDLK_KP5 -#define KEY_KP_6 SDLK_KP6 -#define KEY_KP_7 SDLK_KP7 -#define KEY_KP_8 SDLK_KP8 -#define KEY_KP_9 SDLK_KP9 - -#define KEY_F1 SDLK_F1 -#define KEY_F2 SDLK_F2 -#define KEY_F3 SDLK_F3 -#define KEY_F4 SDLK_F4 -#define KEY_F5 SDLK_F5 -#define KEY_F6 SDLK_F6 -#define KEY_F7 SDLK_F7 -#define KEY_F8 SDLK_F8 -#define KEY_F9 SDLK_F9 -#define KEY_F10 SDLK_F10 -#define KEY_F11 SDLK_F11 -#define KEY_F12 SDLK_F12 -#define KEY_F13 SDLK_F13 -#define KEY_F14 SDLK_F14 -#define KEY_F15 SDLK_F15 -#define KEY_F16 KEY_UNDEFINED -#define KEY_F17 KEY_UNDEFINED -#define KEY_F18 KEY_UNDEFINED -#define KEY_F19 KEY_UNDEFINED -#define KEY_F20 KEY_UNDEFINED -#define KEY_F21 KEY_UNDEFINED -#define KEY_F22 KEY_UNDEFINED -#define KEY_F23 KEY_UNDEFINED -#define KEY_F24 KEY_UNDEFINED - -#else /* X11 type definitions */ - -typedef Pixmap Bitmap; -typedef Window DrawWindow; -typedef Drawable DrawBuffer; - -typedef KeySym Key; - -typedef XEvent Event; -typedef XButtonEvent ButtonEvent; -typedef XMotionEvent MotionEvent; -typedef XKeyEvent KeyEvent; -typedef XExposeEvent ExposeEvent; -typedef XFocusChangeEvent FocusChangeEvent; -typedef XClientMessageEvent ClientMessageEvent; - -#define EVENT_BUTTONPRESS ButtonPress -#define EVENT_BUTTONRELEASE ButtonRelease -#define EVENT_MOTIONNOTIFY MotionNotify -#define EVENT_KEYPRESS KeyPress -#define EVENT_KEYRELEASE KeyRelease -#define EVENT_EXPOSE Expose -#define EVENT_FOCUSIN FocusIn -#define EVENT_FOCUSOUT FocusOut -#define EVENT_CLIENTMESSAGE ClientMessage -#define EVENT_MAPNOTIFY MapNotify -#define EVENT_UNMAPNOTIFY UnmapNotify - -#define KEY_UNDEFINED XK_VoidSymbol - -#define KEY_Return XK_Return -#define KEY_Escape XK_Escape - -#define KEY_Left XK_Left -#define KEY_Right XK_Right -#define KEY_Up XK_Up -#define KEY_Down XK_Down - -#ifdef XK_KP_Left -#define KEY_KP_Left XK_KP_Left -#define KEY_KP_Right XK_KP_Right -#define KEY_KP_Up XK_KP_Up -#define KEY_KP_Down XK_KP_Down -#endif - -#ifdef XK_KP_Enter -#define KEY_KP_Enter XK_KP_Enter -#define KEY_KP_Add XK_KP_Add -#define KEY_KP_Subtract XK_KP_Subtract -#define KEY_KP_Multiply XK_KP_Multiply -#define KEY_KP_Divide XK_KP_Divide -#define KEY_KP_Separator XK_KP_Separator -#endif - -#define KEY_Shift_L XK_Shift_L -#define KEY_Shift_R XK_Shift_R -#define KEY_Control_L XK_Control_L -#define KEY_Control_R XK_Control_R -#define KEY_Meta_L XK_Meta_L -#define KEY_Meta_R XK_Meta_R -#define KEY_Alt_L XK_Alt_L -#define KEY_Alt_R XK_Alt_R -#define KEY_Mode_switch XK_Mode_switch -#define KEY_Multi_key XK_Multi_key - -#define KEY_BackSpace XK_BackSpace -#define KEY_Delete XK_Delete -#define KEY_Insert XK_Insert -#define KEY_Tab XK_Tab -#define KEY_Home XK_Home -#define KEY_End XK_End -#define KEY_Page_Up XK_Page_Up -#define KEY_Page_Down XK_Page_Down - -#define KEY_space XK_space -#define KEY_exclam XK_exclam -#define KEY_quotedbl XK_quotedbl -#define KEY_numbersign XK_numbersign -#define KEY_dollar XK_dollar -#define KEY_percent XK_percent -#define KEY_ampersand XK_ampersand -#define KEY_apostrophe XK_apostrophe -#define KEY_parenleft XK_parenleft -#define KEY_parenright XK_parenright -#define KEY_asterisk XK_asterisk -#define KEY_plus XK_plus -#define KEY_comma XK_comma -#define KEY_minus XK_minus -#define KEY_period XK_period -#define KEY_slash XK_slash - -#define KEY_colon XK_colon -#define KEY_semicolon XK_semicolon -#define KEY_less XK_less -#define KEY_equal XK_equal -#define KEY_greater XK_greater -#define KEY_question XK_question -#define KEY_at XK_at - -#define KEY_bracketleft XK_bracketleft -#define KEY_backslash XK_backslash -#define KEY_bracketright XK_bracketright -#define KEY_asciicircum XK_asciicircum -#define KEY_underscore XK_underscore -#define KEY_grave XK_grave - -#define KEY_quoteleft XK_quoteleft -#define KEY_braceleft XK_braceleft -#define KEY_bar XK_bar -#define KEY_braceright XK_braceright -#define KEY_asciitilde XK_asciitilde - -#define KEY_Adiaeresis XK_Adiaeresis -#define KEY_Odiaeresis XK_Odiaeresis -#define KEY_Udiaeresis XK_Udiaeresis -#define KEY_adiaeresis XK_adiaeresis -#define KEY_odiaeresis XK_odiaeresis -#define KEY_udiaeresis XK_udiaeresis -#define KEY_ssharp XK_ssharp - -#define KEY_A XK_A -#define KEY_B XK_B -#define KEY_C XK_C -#define KEY_D XK_D -#define KEY_E XK_E -#define KEY_F XK_F -#define KEY_G XK_G -#define KEY_H XK_H -#define KEY_I XK_I -#define KEY_J XK_J -#define KEY_K XK_K -#define KEY_L XK_L -#define KEY_M XK_M -#define KEY_N XK_N -#define KEY_O XK_O -#define KEY_P XK_P -#define KEY_Q XK_Q -#define KEY_R XK_R -#define KEY_S XK_S -#define KEY_T XK_T -#define KEY_U XK_U -#define KEY_V XK_V -#define KEY_W XK_W -#define KEY_X XK_X -#define KEY_Y XK_Y -#define KEY_Z XK_Z - -#define KEY_a XK_a -#define KEY_b XK_b -#define KEY_c XK_c -#define KEY_d XK_d -#define KEY_e XK_e -#define KEY_f XK_f -#define KEY_g XK_g -#define KEY_h XK_h -#define KEY_i XK_i -#define KEY_j XK_j -#define KEY_k XK_k -#define KEY_l XK_l -#define KEY_m XK_m -#define KEY_n XK_n -#define KEY_o XK_o -#define KEY_p XK_p -#define KEY_q XK_q -#define KEY_r XK_r -#define KEY_s XK_s -#define KEY_t XK_t -#define KEY_u XK_u -#define KEY_v XK_v -#define KEY_w XK_w -#define KEY_x XK_x -#define KEY_y XK_y -#define KEY_z XK_z - -#define KEY_0 XK_0 -#define KEY_1 XK_1 -#define KEY_2 XK_2 -#define KEY_3 XK_3 -#define KEY_4 XK_4 -#define KEY_5 XK_5 -#define KEY_6 XK_6 -#define KEY_7 XK_7 -#define KEY_8 XK_8 -#define KEY_9 XK_9 - -#define KEY_KP_0 XK_KP_0 -#define KEY_KP_1 XK_KP_1 -#define KEY_KP_2 XK_KP_2 -#define KEY_KP_3 XK_KP_3 -#define KEY_KP_4 XK_KP_4 -#define KEY_KP_5 XK_KP_5 -#define KEY_KP_6 XK_KP_6 -#define KEY_KP_7 XK_KP_7 -#define KEY_KP_8 XK_KP_8 -#define KEY_KP_9 XK_KP_9 - -#define KEY_F1 XK_F1 -#define KEY_F2 XK_F2 -#define KEY_F3 XK_F3 -#define KEY_F4 XK_F4 -#define KEY_F5 XK_F5 -#define KEY_F6 XK_F6 -#define KEY_F7 XK_F7 -#define KEY_F8 XK_F8 -#define KEY_F9 XK_F9 -#define KEY_F10 XK_F10 -#define KEY_F11 XK_F11 -#define KEY_F12 XK_F12 -#define KEY_F13 XK_F13 -#define KEY_F14 XK_F14 -#define KEY_F15 XK_F15 -#define KEY_F16 XK_F16 -#define KEY_F17 XK_F17 -#define KEY_F18 XK_F18 -#define KEY_F19 XK_F19 -#define KEY_F20 XK_F20 -#define KEY_F21 XK_F21 -#define KEY_F22 XK_F22 -#define KEY_F23 XK_F23 -#define KEY_F24 XK_F24 - +#if defined(USE_SDL_LIBRARY) +#include "sdl.h" +#elif defined(USE_X11_LIBRARY) +#include "x11.h" #endif inline void ClearRectangle(Bitmap, int, int, int, int); diff --git a/src/x11.c b/src/x11.c new file mode 100644 index 00000000..b91c410d --- /dev/null +++ b/src/x11.c @@ -0,0 +1,17 @@ +/*********************************************************** +* Rocks'n'Diamonds -- McDuffin Strikes Back! * +*----------------------------------------------------------* +* ©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 * +*----------------------------------------------------------* +* x11.c * +***********************************************************/ + +#ifdef USE_X11_LIBRARY + +#endif /* USE_X11_LIBRARY */ diff --git a/src/x11.h b/src/x11.h new file mode 100644 index 00000000..ae68e343 --- /dev/null +++ b/src/x11.h @@ -0,0 +1,255 @@ +/*********************************************************** +* Rocks'n'Diamonds -- McDuffin Strikes Back! * +*----------------------------------------------------------* +* ©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 * +*----------------------------------------------------------* +* x11.h * +***********************************************************/ + +#ifndef X11_H +#define X11_H + +#ifndef MSDOS +#define XK_MISCELLANY +#define XK_LATIN1 + +#include +#include +#include +#include +#include +#include +#endif /* !MSDOS */ + + +/* X11 type definitions */ + +typedef Pixmap Bitmap; +typedef Window DrawWindow; +typedef Drawable DrawBuffer; + +typedef KeySym Key; + +typedef XEvent Event; +typedef XButtonEvent ButtonEvent; +typedef XMotionEvent MotionEvent; +typedef XKeyEvent KeyEvent; +typedef XExposeEvent ExposeEvent; +typedef XFocusChangeEvent FocusChangeEvent; +typedef XClientMessageEvent ClientMessageEvent; + + +/* X11 symbol definitions */ + +#define EVENT_BUTTONPRESS ButtonPress +#define EVENT_BUTTONRELEASE ButtonRelease +#define EVENT_MOTIONNOTIFY MotionNotify +#define EVENT_KEYPRESS KeyPress +#define EVENT_KEYRELEASE KeyRelease +#define EVENT_EXPOSE Expose +#define EVENT_FOCUSIN FocusIn +#define EVENT_FOCUSOUT FocusOut +#define EVENT_CLIENTMESSAGE ClientMessage +#define EVENT_MAPNOTIFY MapNotify +#define EVENT_UNMAPNOTIFY UnmapNotify + +#define KEY_UNDEFINED XK_VoidSymbol + +#define KEY_Return XK_Return +#define KEY_Escape XK_Escape + +#define KEY_Left XK_Left +#define KEY_Right XK_Right +#define KEY_Up XK_Up +#define KEY_Down XK_Down + +#ifdef XK_KP_Left +#define KEY_KP_Left XK_KP_Left +#define KEY_KP_Right XK_KP_Right +#define KEY_KP_Up XK_KP_Up +#define KEY_KP_Down XK_KP_Down +#endif + +#ifdef XK_KP_Enter +#define KEY_KP_Enter XK_KP_Enter +#define KEY_KP_Add XK_KP_Add +#define KEY_KP_Subtract XK_KP_Subtract +#define KEY_KP_Multiply XK_KP_Multiply +#define KEY_KP_Divide XK_KP_Divide +#define KEY_KP_Separator XK_KP_Separator +#endif + +#define KEY_Shift_L XK_Shift_L +#define KEY_Shift_R XK_Shift_R +#define KEY_Control_L XK_Control_L +#define KEY_Control_R XK_Control_R +#define KEY_Meta_L XK_Meta_L +#define KEY_Meta_R XK_Meta_R +#define KEY_Alt_L XK_Alt_L +#define KEY_Alt_R XK_Alt_R +#define KEY_Mode_switch XK_Mode_switch +#define KEY_Multi_key XK_Multi_key + +#define KEY_BackSpace XK_BackSpace +#define KEY_Delete XK_Delete +#define KEY_Insert XK_Insert +#define KEY_Tab XK_Tab +#define KEY_Home XK_Home +#define KEY_End XK_End +#define KEY_Page_Up XK_Page_Up +#define KEY_Page_Down XK_Page_Down + +#define KEY_space XK_space +#define KEY_exclam XK_exclam +#define KEY_quotedbl XK_quotedbl +#define KEY_numbersign XK_numbersign +#define KEY_dollar XK_dollar +#define KEY_percent XK_percent +#define KEY_ampersand XK_ampersand +#define KEY_apostrophe XK_apostrophe +#define KEY_parenleft XK_parenleft +#define KEY_parenright XK_parenright +#define KEY_asterisk XK_asterisk +#define KEY_plus XK_plus +#define KEY_comma XK_comma +#define KEY_minus XK_minus +#define KEY_period XK_period +#define KEY_slash XK_slash + +#define KEY_colon XK_colon +#define KEY_semicolon XK_semicolon +#define KEY_less XK_less +#define KEY_equal XK_equal +#define KEY_greater XK_greater +#define KEY_question XK_question +#define KEY_at XK_at + +#define KEY_bracketleft XK_bracketleft +#define KEY_backslash XK_backslash +#define KEY_bracketright XK_bracketright +#define KEY_asciicircum XK_asciicircum +#define KEY_underscore XK_underscore +#define KEY_grave XK_grave + +#define KEY_quoteleft XK_quoteleft +#define KEY_braceleft XK_braceleft +#define KEY_bar XK_bar +#define KEY_braceright XK_braceright +#define KEY_asciitilde XK_asciitilde + +#define KEY_Adiaeresis XK_Adiaeresis +#define KEY_Odiaeresis XK_Odiaeresis +#define KEY_Udiaeresis XK_Udiaeresis +#define KEY_adiaeresis XK_adiaeresis +#define KEY_odiaeresis XK_odiaeresis +#define KEY_udiaeresis XK_udiaeresis +#define KEY_ssharp XK_ssharp + +#define KEY_A XK_A +#define KEY_B XK_B +#define KEY_C XK_C +#define KEY_D XK_D +#define KEY_E XK_E +#define KEY_F XK_F +#define KEY_G XK_G +#define KEY_H XK_H +#define KEY_I XK_I +#define KEY_J XK_J +#define KEY_K XK_K +#define KEY_L XK_L +#define KEY_M XK_M +#define KEY_N XK_N +#define KEY_O XK_O +#define KEY_P XK_P +#define KEY_Q XK_Q +#define KEY_R XK_R +#define KEY_S XK_S +#define KEY_T XK_T +#define KEY_U XK_U +#define KEY_V XK_V +#define KEY_W XK_W +#define KEY_X XK_X +#define KEY_Y XK_Y +#define KEY_Z XK_Z + +#define KEY_a XK_a +#define KEY_b XK_b +#define KEY_c XK_c +#define KEY_d XK_d +#define KEY_e XK_e +#define KEY_f XK_f +#define KEY_g XK_g +#define KEY_h XK_h +#define KEY_i XK_i +#define KEY_j XK_j +#define KEY_k XK_k +#define KEY_l XK_l +#define KEY_m XK_m +#define KEY_n XK_n +#define KEY_o XK_o +#define KEY_p XK_p +#define KEY_q XK_q +#define KEY_r XK_r +#define KEY_s XK_s +#define KEY_t XK_t +#define KEY_u XK_u +#define KEY_v XK_v +#define KEY_w XK_w +#define KEY_x XK_x +#define KEY_y XK_y +#define KEY_z XK_z + +#define KEY_0 XK_0 +#define KEY_1 XK_1 +#define KEY_2 XK_2 +#define KEY_3 XK_3 +#define KEY_4 XK_4 +#define KEY_5 XK_5 +#define KEY_6 XK_6 +#define KEY_7 XK_7 +#define KEY_8 XK_8 +#define KEY_9 XK_9 + +#define KEY_KP_0 XK_KP_0 +#define KEY_KP_1 XK_KP_1 +#define KEY_KP_2 XK_KP_2 +#define KEY_KP_3 XK_KP_3 +#define KEY_KP_4 XK_KP_4 +#define KEY_KP_5 XK_KP_5 +#define KEY_KP_6 XK_KP_6 +#define KEY_KP_7 XK_KP_7 +#define KEY_KP_8 XK_KP_8 +#define KEY_KP_9 XK_KP_9 + +#define KEY_F1 XK_F1 +#define KEY_F2 XK_F2 +#define KEY_F3 XK_F3 +#define KEY_F4 XK_F4 +#define KEY_F5 XK_F5 +#define KEY_F6 XK_F6 +#define KEY_F7 XK_F7 +#define KEY_F8 XK_F8 +#define KEY_F9 XK_F9 +#define KEY_F10 XK_F10 +#define KEY_F11 XK_F11 +#define KEY_F12 XK_F12 +#define KEY_F13 XK_F13 +#define KEY_F14 XK_F14 +#define KEY_F15 XK_F15 +#define KEY_F16 XK_F16 +#define KEY_F17 XK_F17 +#define KEY_F18 XK_F18 +#define KEY_F19 XK_F19 +#define KEY_F20 XK_F20 +#define KEY_F21 XK_F21 +#define KEY_F22 XK_F22 +#define KEY_F23 XK_F23 +#define KEY_F24 XK_F24 + +#endif /* X11_H */