aboutsummaryrefslogtreecommitdiff
path: root/src/skel/skeleton.h
blob: 380b6c058840cb2f6952080ffcc1c68bc4a19296 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
#ifndef SKELETON_H
#define SKELETON_H

#include "rwcore.h"

/* Default arena size depending on platform. */
#define rsRESOURCESDEFAULTARENASIZE (1 << 20)

#if (!defined(RsSprintf))
#define RsSprintf rwsprintf
#endif /* (!defined(RsSprintf)) */

#ifdef    __cplusplus
extern "C"
{
#endif                          /* __cplusplus */

#if (!defined(RSASSERT))
#define RSASSERT(_condition) /* No-op */
#endif /* (!defined(RSASSERT)) */

#define RSASSERTISTYPE(_f, _t) \
   RSASSERT( (!(_f)) || ((((const RwObject *)(_f))->type)==(_t)) )

enum RsInputDeviceType
{
	rsKEYBOARD,
	rsMOUSE,
	rsPAD
};
typedef enum RsInputDeviceType RsInputDeviceType;

enum RsEventStatus
{
	rsEVENTERROR,
	rsEVENTPROCESSED,
	rsEVENTNOTPROCESSED
};
typedef enum RsEventStatus RsEventStatus;

enum RsEvent
{
	rsCAMERASIZE,
	rsCOMMANDLINE,
	rsFILELOAD,
	rsINITDEBUG,
	rsINPUTDEVICEATTACH,
	rsLEFTBUTTONDOWN,
	rsLEFTBUTTONUP,
	rsMOUSEMOVE,
	rsMOUSEWHEELMOVE,
	rsPLUGINATTACH,
	rsREGISTERIMAGELOADER,
	rsRIGHTBUTTONDOWN,
	rsRIGHTBUTTONUP,
	_rs_13,
	_rs_14,
	_rs_15,
	_rs_16,
	_rs_17,
	_rs_18,
	_rs_19,
	_rs_20,
	rsRWINITIALIZE,
	rsRWTERMINATE,
	rsSELECTDEVICE,
	rsINITIALIZE,
	rsTERMINATE,
	rsIDLE,
	rsFRONTENDIDLE,
	rsKEYDOWN,
	rsKEYUP,
	rsQUITAPP,
	rsPADBUTTONDOWN,
	rsPADBUTTONUP,
	rsPADANALOGUELEFT,
	rsPADANALOGUELEFTRESET,
	rsPADANALOGUERIGHT,
	rsPADANALOGUERIGHTRESET,
	rsPREINITCOMMANDLINE,
	rsACTIVATE,
};

typedef enum RsEvent RsEvent;

typedef RsEventStatus (*RsInputEventHandler)(RsEvent event, void *param);

typedef struct RsInputDevice RsInputDevice;
struct RsInputDevice
{
	RsInputDeviceType inputDeviceType;
	RwBool used;
	RsInputEventHandler inputEventHandler;
};

typedef struct RsGlobalType RsGlobalType;
struct RsGlobalType
{
	const RwChar *appName;
	RwInt32 width;
	RwInt32 height;
	RwInt32 maximumWidth;
	RwInt32 maximumHeight;
	RwInt32 maxFPS;
	RwBool  quit;

	void   *ps; /* platform specific data */

	RsInputDevice keyboard;
	RsInputDevice mouse;
	RsInputDevice pad;
};

enum RsKeyCodes
{
	rsESC            = 1000,
	
	rsF1             = 1001,
	rsF2             = 1002,
	rsF3             = 1003,
	rsF4             = 1004,
	rsF5             = 1005,
	rsF6             = 1006,
	rsF7             = 1007,
	rsF8             = 1008,
	rsF9             = 1009,
	rsF10            = 1010,
	rsF11            = 1011,
	rsF12            = 1012,
	
	rsINS            = 1013,
	rsDEL            = 1014,
	rsHOME           = 1015,
	rsEND            = 1016,
	rsPGUP           = 1017,
	rsPGDN           = 1018,
	
	rsUP             = 1019,
	rsDOWN           = 1020,
	rsLEFT           = 1021,
	rsRIGHT          = 1022,
	
	rsDIVIDE         = 1023,
	rsTIMES          = 1024,
	rsPLUS           = 1025,
	rsMINUS          = 1026,
	rsPADDEL         = 1027,
	rsPADEND         = 1028,
	rsPADDOWN        = 1029,
	rsPADPGDN        = 1030,
	rsPADLEFT        = 1031,
	rsPAD5           = 1032,
	rsNUMLOCK        = 1033,
	rsPADRIGHT       = 1034,
	rsPADHOME        = 1035,
	rsPADUP          = 1036,
	rsPADPGUP        = 1037,
	rsPADINS         = 1038,
	rsPADENTER       = 1039,
	
	rsSCROLL         = 1040,
	rsPAUSE          = 1041,
	
	rsBACKSP         = 1042,
	rsTAB            = 1043,
	rsCAPSLK         = 1044,
	rsENTER          = 1045,
	rsLSHIFT         = 1046,
	rsRSHIFT         = 1047,
	rsSHIFT          = 1048,
	rsLCTRL          = 1049,
	rsRCTRL          = 1050,
	rsLALT           = 1051,
	rsRALT           = 1052,
	rsLWIN           = 1053,
	rsRWIN           = 1054,
	rsAPPS           = 1055,
	
	rsNULL           = 1056,

	rsMOUSELEFTBUTTON      = 1,
	rsMOUSMIDDLEBUTTON     = 2,
	rsMOUSERIGHTBUTTON     = 3,
	rsMOUSEWHEELUPBUTTON   = 4,
	rsMOUSEWHEELDOWNBUTTON = 5,
	rsMOUSEX1BUTTON        = 6,
	rsMOUSEX2BUTTON        = 7,
};
typedef enum RsKeyCodes RsKeyCodes;

typedef struct RsKeyStatus RsKeyStatus;
struct RsKeyStatus
{
	RwInt32     keyCharCode;
};

typedef struct RsPadButtonStatus RsPadButtonStatus;
struct RsPadButtonStatus
{
	RwInt32     padID;
};

enum RsPadButtons
{
	rsPADNULL       = 0,
	
	rsPADBUTTON1    = 1,
	rsPADBUTTON2    = 2,
	rsPADBUTTON3    = 3,
	rsPADBUTTON4    = 4,
	
	rsPADBUTTON5    = 5,
	rsPADBUTTON6    = 6,
	rsPADBUTTON7    = 7,
	rsPADBUTTON8    = 8,
	
	rsPADSELECT     = 9,
	
	rsPADBUTTONA1   = 10,
	rsPADBUTTONA2   = 11,
	
	rsPADSTART      = 12,
	
	rsPADDPADUP     = 13,
	rsPADDPADRIGHT  = 14,
	rsPADDPADDOWN   = 15,
	rsPADDPADLEFT   = 16,
};
typedef enum RsPadButtons RsPadButtons;


extern RsGlobalType RsGlobal;

extern RsEventStatus AppEventHandler(RsEvent event, void *param);
extern RwBool        AttachInputDevices(void);

extern RsEventStatus RsEventHandler(RsEvent event, void *param);
extern RsEventStatus RsKeyboardEventHandler(RsEvent event, void *param);
extern RsEventStatus RsPadEventHandler(RsEvent event, void *param);

extern RwBool
RsInitialize(void);

extern RwBool
RsRegisterImageLoader(void);

extern RwBool
RsRwInitialize(void *param);

extern RwBool
RsSelectDevice(void);

extern RwBool
RsInputDeviceAttach(RsInputDeviceType inputDevice,
					RsInputEventHandler inputEventHandler);

#ifdef _WIN32
extern RwUInt32    
#else
extern double
#endif             
RsTimer(void);

extern void                     
RsCameraShowRaster(RwCamera *camera);

extern RwBool                     
RsCameraBeginUpdate(RwCamera *camera);

//TODO
//extern void                     
//RsMouseSetVisibility(RwBool visible);

extern RwImage*
RsGrabScreen(RwCamera *camera);

extern void                     
RsMouseSetPos(RwV2d *pos);

extern void                     
RsRwTerminate(void);

extern void                     
RsTerminate(void);

#ifdef    __cplusplus
}
#endif                          /* __cplusplus */

#endif /* SKELETON_H */