Mercurial > hg > forks > pwpunix
annotate pwplib/pwplib.h @ 50:e2b6a35bcb0c
Remove usage of malloc.h; Other misc cleanups.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 24 May 2010 08:48:18 +0300 |
parents | 423ff2a11018 |
children | 85671798fdb3 |
rev | line source |
---|---|
0 | 1 #ifndef __PWPLIB_H |
2 #define __PWPLIB_H | |
3 | |
42 | 4 #define PWPLIB_VERSION "1.95" |
0 | 5 |
6 #ifdef UNIX | |
7 #define __POSIX__ | |
8 #endif | |
9 | |
10 /************** user interface *************/ | |
11 | |
12 int pwplib_init(int argc,char**argv); | |
13 int pwplib_timer(); | |
14 void pwplib_shutdown(); | |
15 void pwplib_startup(); | |
16 | |
17
c60e531d19cd
Some misc. cleanups and minor warning removals.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
17 void pwplib_regdestr(void(*func)()); |
c60e531d19cd
Some misc. cleanups and minor warning removals.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
18 |
0 | 19 #define pwplib_buf pwplib.videobuf.d |
20 #define pwplib_bufw pwplib.videobuf.width | |
21 #define pwplib_bufh pwplib.videobuf.height | |
22 | |
23 #define pwplib_prep_rast() pwplib.prep_rast() | |
24 #define pwplib_dump_rast() pwplib.dump_rast() | |
25 | |
26 #define pwplib_prep_attr() pwplib.prep_attr() | |
27 #define pwplib_dump_attr() pwplib.dump_attr() | |
28 | |
29 #define pwplib_prep_layered() pwplib.prep_layered() | |
30 #define pwplib_dump_layered() pwplib.dump_layered() | |
31 | |
32 #define pwplib_loopflush() pwplib.loopflush() | |
33 | |
34 #define pwplib_setplayer(p) pwplib.player=p | |
35 #define pwplib_player() pwplib.player() | |
36 | |
37 #define pwplib_sound_off(c) pwplib.sound(c,0,0,0) | |
38 #define pwplib_sound_n(c,n) p pwplib.sound(c,n,128,128) | |
39 #define pwplib_sound_nv(c,n,v) pwplib.sound(c,n,v,128) | |
40 #define pwplib_sound_nvr(c,n,v,r) pwplib.sound(c,n,v,r) | |
41 | |
42 #define pwplib_locale pwplib.set.lang | |
43 | |
44 #define pwplib_setup(var) pwplib.setup[SETUP_##var] | |
45 | |
46 /*******************************************/ | |
47 | |
48 #include <stdio.h> | |
49 #include <stdlib.h> | |
50 #include <string.h> | |
51 #include <time.h> | |
52 #include <sys/time.h> | |
53 | |
17
c60e531d19cd
Some misc. cleanups and minor warning removals.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
54 #include <stdarg.h> |
c60e531d19cd
Some misc. cleanups and minor warning removals.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
55 void pwpwrite(const char *, ...); |
c60e531d19cd
Some misc. cleanups and minor warning removals.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
56 |
0 | 57 #ifdef __POSIX__ |
58 | |
59 #include <unistd.h> | |
60 #include <fcntl.h> | |
61 #include <termios.h> | |
62 #include <term.h> | |
63 #include <signal.h> | |
64 | |
65 #endif | |
66 | |
67 #include "types.h" | |
68 #include "config.h" | |
69 | |
70 #ifndef __PWPLIB_C | |
71 extern | |
72 #endif | |
73 struct | |
74 { | |
75 int argc; | |
76 char**argv; | |
77 | |
78 struct | |
79 { | |
80 u8*d; | |
81 int width,height; | |
82 int aspect; | |
83 }videobuf; | |
84 | |
85 void(*prep_rast)(); | |
86 void(*dump_rast)(); | |
87 | |
88 void(*prep_attr)(); | |
89 void(*dump_attr)(); | |
90 | |
91 void(*dump_layered)(); | |
92 void(*prep_layered)(); | |
93 | |
94 void(*sound)(int ch,int note,int vol,int ratio); | |
95 void(*loopflush)(); | |
96 void(*player)(); | |
97 | |
98 /*** internal stuff ***/ | |
99 | |
100 int timer_counter; | |
101 | |
102 int(*timerfunc)(); | |
103 | |
21
f0869ef0f2d9
Add commandline settings for fullscreen and changing horiz/vert resolution of SDL output. Also hide the mouse cursor.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
104 int setup[128]; |
0 | 105 |
106 struct | |
107 { | |
108 char*dev; | |
109 char*term; | |
110 char*lang; | |
111 char*audev; | |
112 | |
113 int wanthelp; | |
114 | |
115 int framedelay; | |
116 int framebytes; | |
117 | |
118 int infodelay; | |
119 | |
120 char temp_pad[12]; | |
121 | |
122 /* etc... replace the whole setup structure */ | |
123 }set; | |
124 | |
125 int frame; | |
126 }pwplib; | |
127 | |
128 enum | |
129 { | |
130 SETUP_NOSOUND=0, | |
131 SETUP_NOVIDEO, | |
132 | |
133 SETUP_VOLUME, | |
134 SETUP_TRANS, | |
135 SETUP_COLORS, | |
136 SETUP_RASTER, | |
137 SETUP_HALVE, | |
138 SETUP_TTY, | |
139 SETUP_FPS, | |
140 SETUP_BPS, | |
141 SETUP_LOSSY, | |
142 SETUP_PVP, | |
143 SETUP_MINFPS, | |
144 SETUP_MAXFPS, | |
145 SETUP_SHUTUP, | |
146 SETUP_USERHEIGHT, | |
147 SETUP_USERWIDTH, | |
21
f0869ef0f2d9
Add commandline settings for fullscreen and changing horiz/vert resolution of SDL output. Also hide the mouse cursor.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
148 SETUP_WANTHELP, |
f0869ef0f2d9
Add commandline settings for fullscreen and changing horiz/vert resolution of SDL output. Also hide the mouse cursor.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
149 |
f0869ef0f2d9
Add commandline settings for fullscreen and changing horiz/vert resolution of SDL output. Also hide the mouse cursor.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
150 SETUP_FULLSCREEN, |
f0869ef0f2d9
Add commandline settings for fullscreen and changing horiz/vert resolution of SDL output. Also hide the mouse cursor.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
151 SETUP_XRES, |
f0869ef0f2d9
Add commandline settings for fullscreen and changing horiz/vert resolution of SDL output. Also hide the mouse cursor.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
152 SETUP_YRES |
0 | 153 }; |
154 | |
155 #ifndef __PWPLIB_C | |
156 extern | |
157 #endif | |
158 void pwp_timer_regframe(int bytes); | |
159 | |
160 typedef struct | |
161 { | |
21
f0869ef0f2d9
Add commandline settings for fullscreen and changing horiz/vert resolution of SDL output. Also hide the mouse cursor.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
162 char *name; |
0 | 163 int type; |
21
f0869ef0f2d9
Add commandline settings for fullscreen and changing horiz/vert resolution of SDL output. Also hide the mouse cursor.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
164 void *dflt; |
f0869ef0f2d9
Add commandline settings for fullscreen and changing horiz/vert resolution of SDL output. Also hide the mouse cursor.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
165 void **var; |
0 | 166 }optab; |
167 | |
168 #define OPT_BIN 0 | |
169 #define OPT_NOT 1 | |
170 #define OPT_ONE 2 | |
171 #define OPT_INT 3 | |
172 #define OPT_STRING 4 | |
173 #define OPT_SETDEF 5 | |
174 #define OPT_NODEF 128 | |
175 | |
176 #define STDIN 0 | |
177 #define STDOUT 1 | |
178 #define STDERR 2 | |
179 | |
180 char* pwp_get_locale(); | |
181 void pwplib_dump_rast_plain(); | |
182 int pwp_timer_nrt(); | |
35 | 183 void pwplib_getopts(); |
50
e2b6a35bcb0c
Remove usage of malloc.h; Other misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
42
diff
changeset
|
184 void pwplib_printhelp(); |
0 | 185 |
186 #endif |