rnd-20001202-1-src
[rocksndiamonds.git] / src / libgame / 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 #include "libgame.h"
19
20 #if defined(PLATFORM_MSDOS)
21 #include "msdos.h"
22 #endif
23
24 #if defined(TARGET_SDL)
25 #include "sdl.h"
26 #elif defined(TARGET_X11)
27 #include "x11.h"
28 #endif
29
30
31 /* contant definitions */
32
33 #define DEFAULT_DEPTH                   0
34
35 #define FULLSCREEN_NOT_AVAILABLE        FALSE
36 #define FULLSCREEN_AVAILABLE            TRUE
37
38
39 /* type definitions */
40
41 typedef int (*EventFilter)(const Event *);
42
43
44 /* structure definitions */
45
46 struct ProgramInfo
47 {
48   char *command_name;
49   char *program_title;
50   char *window_title;
51   char *icon_title;
52   char *x11_icon_filename;
53   char *x11_iconmask_filename;
54 };
55
56 struct VideoSystemInfo
57 {
58   int default_depth;
59   int width, height, depth;
60   boolean fullscreen_available;
61   boolean fullscreen_enabled;
62 };
63
64 struct AudioSystemInfo
65 {
66   boolean sound_available;
67   boolean loops_available;
68   int soundserver_pipe[2];
69   int soundserver_pid;
70   char *device_name;
71   int device_fd;
72 };
73
74 struct OptionInfo
75 {
76   char *display_name;
77   char *server_host;
78   int server_port;
79   char *ro_base_directory;
80   char *rw_base_directory;
81   char *level_directory;
82   boolean serveronly;
83   boolean network;
84   boolean verbose;
85   boolean debug;
86 };
87
88
89 /* ========================================================================= */
90 /* exported variables                                                        */
91 /* ========================================================================= */
92
93 extern struct ProgramInfo       program;
94 extern struct VideoSystemInfo   video;
95 extern struct AudioSystemInfo   audio;
96 extern struct OptionInfo        options;
97
98
99 /* declarations of internal variables */
100
101 extern Display         *display;
102 extern Visual          *visual;
103 extern int              screen;
104 extern Colormap         cmap;
105
106 extern DrawWindow       window;
107 extern GC               gc;
108
109 extern int              FrameCounter;
110
111
112 /* function definitions */
113
114 inline void InitProgramInfo(char *, char *, char *, char *, char *, char *);
115 inline void InitVideoDisplay(void);
116 inline void InitVideoBuffer(DrawBuffer *,DrawWindow *, int, int, int, boolean);
117 inline Bitmap CreateBitmap(int, int, int);
118 inline void FreeBitmap(Bitmap);
119 inline void ClearRectangle(Bitmap, int, int, int, int);
120 inline void BlitBitmap(Bitmap, Bitmap, int, int, int, int, int, int);
121 inline void SetClipMask(GC, Pixmap);
122 inline void SetClipOrigin(GC, int, int);
123 inline void BlitBitmapMasked(Bitmap, Bitmap, int, int, int, int, int, int);
124 inline void DrawSimpleWhiteLine(Bitmap, int, int, int, int);
125 inline void FlushDisplay(void);
126 inline void SyncDisplay(void);
127 inline void KeyboardAutoRepeatOn(void);
128 inline void KeyboardAutoRepeatOff(void);
129 inline boolean PointerInWindow(DrawWindow);
130 inline boolean SetVideoMode(boolean);
131 inline boolean ChangeVideoModeIfNeeded(boolean);
132
133 inline boolean OpenAudio(struct AudioSystemInfo *);
134 inline void CloseAudio(struct AudioSystemInfo *);
135
136 inline void InitEventFilter(EventFilter);
137 inline boolean PendingEvent(void);
138 inline void NextEvent(Event *event);
139 inline Key GetEventKey(KeyEvent *, boolean);
140 inline boolean CheckCloseWindowEvent(ClientMessageEvent *);
141
142 #endif /* SYSTEM_H */