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