Mercurial > hg > forks > pwpunix
annotate pwplib/pwplib.h @ 35:b9d679965320
Code cleanups.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 24 May 2010 01:22:33 +0300 |
parents | f0869ef0f2d9 |
children | 423ff2a11018 |
rev | line source |
---|---|
0 | 1 #ifndef __PWPLIB_H |
2 #define __PWPLIB_H | |
3 | |
4 #define PWPLIB_VERSION "1.90" | |
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 <malloc.h> | |
51 #include <string.h> | |
52 #include <time.h> | |
53 #include <sys/time.h> | |
54 | |
17
c60e531d19cd
Some misc. cleanups and minor warning removals.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
55 #include <stdarg.h> |
c60e531d19cd
Some misc. cleanups and minor warning removals.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
56 void pwpwrite(const char *, ...); |
c60e531d19cd
Some misc. cleanups and minor warning removals.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
57 |
0 | 58 #ifdef __POSIX__ |
59 | |
60 #include <unistd.h> | |
61 #include <fcntl.h> | |
62 #include <termios.h> | |
63 #include <term.h> | |
64 #include <signal.h> | |
65 | |
66 #endif | |
67 | |
68 #include "types.h" | |
69 #include "config.h" | |
70 | |
71 #ifndef __PWPLIB_C | |
72 extern | |
73 #endif | |
74 struct | |
75 { | |
76 int argc; | |
77 char**argv; | |
78 | |
79 struct | |
80 { | |
81 u8*d; | |
82 int width,height; | |
83 int aspect; | |
84 }videobuf; | |
85 | |
86 void(*prep_rast)(); | |
87 void(*dump_rast)(); | |
88 | |
89 void(*prep_attr)(); | |
90 void(*dump_attr)(); | |
91 | |
92 void(*dump_layered)(); | |
93 void(*prep_layered)(); | |
94 | |
95 void(*sound)(int ch,int note,int vol,int ratio); | |
96 void(*loopflush)(); | |
97 void(*player)(); | |
98 | |
99 /*** internal stuff ***/ | |
100 | |
101 int timer_counter; | |
102 | |
103 int(*timerfunc)(); | |
104 | |
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
|
105 int setup[128]; |
0 | 106 |
107 struct | |
108 { | |
109 char*dev; | |
110 char*term; | |
111 char*lang; | |
112 char*audev; | |
113 | |
114 int wanthelp; | |
115 | |
116 int framedelay; | |
117 int framebytes; | |
118 | |
119 int infodelay; | |
120 | |
121 char temp_pad[12]; | |
122 | |
123 /* etc... replace the whole setup structure */ | |
124 }set; | |
125 | |
126 int frame; | |
127 }pwplib; | |
128 | |
129 enum | |
130 { | |
131 SETUP_NOSOUND=0, | |
132 SETUP_NOVIDEO, | |
133 | |
134 SETUP_VOLUME, | |
135 SETUP_TRANS, | |
136 SETUP_COLORS, | |
137 SETUP_RASTER, | |
138 SETUP_HALVE, | |
139 SETUP_TTY, | |
140 SETUP_FPS, | |
141 SETUP_BPS, | |
142 SETUP_LOSSY, | |
143 SETUP_PVP, | |
144 SETUP_MINFPS, | |
145 SETUP_MAXFPS, | |
146 SETUP_SHUTUP, | |
147 SETUP_USERHEIGHT, | |
148 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
|
149 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
|
150 |
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_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
|
152 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
|
153 SETUP_YRES |
0 | 154 }; |
155 | |
156 #ifndef __PWPLIB_C | |
157 extern | |
158 #endif | |
159 void pwp_timer_regframe(int bytes); | |
160 | |
161 typedef struct | |
162 { | |
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
|
163 char *name; |
0 | 164 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
|
165 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
|
166 void **var; |
0 | 167 }optab; |
168 | |
169 #define OPT_BIN 0 | |
170 #define OPT_NOT 1 | |
171 #define OPT_ONE 2 | |
172 #define OPT_INT 3 | |
173 #define OPT_STRING 4 | |
174 #define OPT_SETDEF 5 | |
175 #define OPT_NODEF 128 | |
176 | |
177 #define STDIN 0 | |
178 #define STDOUT 1 | |
179 #define STDERR 2 | |
180 | |
181 char* pwp_get_locale(); | |
182 void pwplib_dump_rast_plain(); | |
183 int pwp_timer_nrt(); | |
35 | 184 void pwplib_getopts(); |
0 | 185 |
186 #endif |