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