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