35351e32a614f8083b4f34afd7d617692f17ad65
[rocksndiamonds.git] / src / system.h
1 /***********************************************************
2 *  Rocks'n'Diamonds -- McDuffin Strikes Back!              *
3 *----------------------------------------------------------*
4 *  ©1995 Artsoft Development                               *
5 *        Holger Schemel                                    *
6 *        33659 Bielefeld-Senne                             *
7 *        Telefon: (0521) 493245                            *
8 *        eMail: aeglos@valinor.owl.de                      *
9 *               aeglos@uni-paderborn.de                    *
10 *               q99492@pbhrzx.uni-paderborn.de             *
11 *----------------------------------------------------------*
12 *  system.h                                                *
13 ***********************************************************/
14
15 #ifndef SYSTEM_H
16 #define SYSTEM_H
17
18 #ifndef MSDOS
19 #include <X11/Xlib.h>
20 #include <X11/Xutil.h>
21 #include <X11/Xatom.h>
22 #include <X11/Xos.h>
23 #include <X11/Intrinsic.h>
24 #include <X11/keysymdef.h>
25 #endif
26
27 #ifdef USE_SDL_LIBRARY
28 #include "sdl.h"
29 #endif
30
31 #ifdef USE_SDL_LIBRARY
32 typedef SDL_Surface *Bitmap;
33 typedef SDL_Surface *DrawWindow;
34 typedef SDL_Surface *DrawBuffer;
35 #else
36 typedef Pixmap Bitmap;
37 typedef Window DrawWindow;
38 typedef Drawable DrawBuffer;
39 #endif
40
41 #ifdef USE_SDL_LIBRARY
42
43 typedef SDL_Event               Event;
44 typedef SDL_MouseButtonEvent    ButtonEvent;
45 typedef SDL_MouseMotionEvent    MotionEvent;
46 typedef XKeyEvent               KeyEvent;
47 typedef XExposeEvent            ExposeEvent;
48 typedef XFocusChangeEvent       FocusChangeEvent;
49 typedef XClientMessageEvent     ClientMessageEvent;
50
51 #define EVENT_BUTTONPRESS       SDL_MOUSEBUTTONDOWN
52 #define EVENT_BUTTONRELEASE     SDL_MOUSEBUTTONUP
53 #define EVENT_MOTIONNOTIFY      SDL_MOUSEMOTION
54 #define EVENT_KEYPRESS          SDL_KEYDOWN
55 #define EVENT_KEYRELEASE        SDL_KEYUP
56 #define EVENT_EXPOSE            SDL_USEREVENT + 0
57 #define EVENT_FOCUSIN           SDL_USEREVENT + 1
58 #define EVENT_FOCUSOUT          SDL_USEREVENT + 2
59 #define EVENT_CLIENTMESSAGE     SDL_QUIT
60 #define EVENT_MAPNOTIFY         SDL_USEREVENT + 4
61 #define EVENT_UNMAPNOTIFY       SDL_USEREVENT + 5
62
63 #else
64
65 typedef XEvent                  Event;
66 typedef XButtonEvent            ButtonEvent;
67 typedef XMotionEvent            MotionEvent;
68 typedef XKeyEvent               KeyEvent;
69 typedef XExposeEvent            ExposeEvent;
70 typedef XFocusChangeEvent       FocusChangeEvent;
71 typedef XClientMessageEvent     ClientMessageEvent;
72
73 #define EVENT_BUTTONPRESS       ButtonPress
74 #define EVENT_BUTTONRELEASE     ButtonRelease
75 #define EVENT_MOTIONNOTIFY      MotionNotify
76 #define EVENT_KEYPRESS          KeyPress
77 #define EVENT_KEYRELEASE        KeyRelease
78 #define EVENT_EXPOSE            Expose
79 #define EVENT_FOCUSIN           FocusIn
80 #define EVENT_FOCUSOUT          FocusOut
81 #define EVENT_CLIENTMESSAGE     ClientMessage
82 #define EVENT_MAPNOTIFY         MapNotify
83 #define EVENT_UNMAPNOTIFY       UnmapNotify
84
85 #endif
86
87 inline void ClearRectangle(Bitmap, int, int, int, int);
88 inline void BlitBitmap(Bitmap, Bitmap, int, int, int, int, int, int);
89 inline void SetClipMask(GC, Pixmap);
90 inline void SetClipOrigin(GC, int, int);
91 inline void BlitBitmapMasked(Bitmap, Bitmap, int, int, int, int, int, int);
92 inline void DrawSimpleWhiteLine(Bitmap, int, int, int, int);
93
94 inline void FlushDisplay();
95 inline void SyncDisplay();
96 inline void KeyboardAutoRepeatOn();
97 inline void KeyboardAutoRepeatOff();
98 inline boolean QueryPointer(DrawWindow, int *, int *);
99
100 inline boolean PendingEvent();
101 inline void NextEvent(Event *event);
102
103 #endif /* SYSTEM_H */