The Game Engine
1
Main Page
Related Pages
Classes
Files
File List
File Members
Player.h
Go to the documentation of this file.
1
#ifndef __PLAYER_H__
2
#define __PLAYER_H__
3
#include <vector>
4
#include <string>
5
#include "
Input.h
"
6
#include "
WorldObject.h
"
7
8
18
class
Player
19
{
20
public
:
21
Player
(
string
filename);
22
27
enum
InputAction
{
28
Accept
,
29
Deny
,
30
OpenMenu
,
31
Esc
,
32
Move
,
33
MoveUp
,
34
MoveDown
,
35
MoveLeft
,
36
MoveRight
,
37
Cursor
,
38
CursorUp
,
39
CursorDown
,
40
CursorLeft
,
41
CursorRight
,
42
Action
,
43
HotKey1
,
44
HotKey2
,
45
HotKey3
,
46
HotKey4
,
47
HotKey5
,
48
HotKey6
,
49
HotKey7
,
50
HotKey8
,
51
HotKey9
,
52
HotKey10
,
53
HotKey11
,
54
HotKey12
,
//probably going to be unusued
55
LBump
,
56
RBump
,
57
LTrigger
,
58
RTrigger
59
};
60
61
Player
(map<
InputAction
, vector<SDLKey>> keyMaps);
62
63
Player
(map<
InputAction
, vector<JoyStick>> joyMaps, map<
InputAction
, vector<JoyButton>> buttonMaps,
int
moveJoy = 0 );
64
69
void
Control
(
WorldObject
* wo);
70
75
void
RemoveControl
(
WorldObject
* wo);
76
81
void
RemoveControl
(
string
woName);
82
88
WorldObject
*
getObject
(
string
name);
89
96
WorldObject
*
getObject
(
unsigned
int
index
);
97
102
vector<WorldObject*>
getObjects
();
103
111
vector<WorldObject*>
getObjects
(
string
name,
int
count = -1);
112
113
118
Point2D
getAveragePosition
();
119
125
Point2D
getAveragePosition
(
string
name);
126
135
Point2D
getAveragePosition
(vector<int> indices);
136
144
Point2D
getAveragePosition
(vector<string> names);
145
152
void
setPosition
(
double
x,
double
y);
153
159
void
setPosition
(
Point2D
pos);
160
166
void
move
(
double
dx,
double
dy);
167
172
void
move
(
Point2D
direction);
173
178
void
moveTowards
(
Point2D
point);
179
185
void
setTransparency
(
float
f);
186
192
void
changeTransparency
(
float
df);
193
198
void
addKeyDownCallback
(
void
(*fn)(SDLKey, SDLMod));
199
204
void
removeKeyDownCallback
(
void
(*fn)(SDLKey, SDLMod));
205
210
void
addKeyUpCallback
(
void
(*fn)(SDLKey, SDLMod));
211
216
void
removeKeyUpCallback
(
void
(*fn)(SDLKey, SDLMod));
217
222
void
addMouseDownCallback
(
void
(*fn)(Uint8,
Input::MouseState
));
223
228
void
removeMouseDownCallback
(
void
(*fn)(Uint8,
Input::MouseState
));
229
234
void
addMouseUpCallback
(
void
(*fn)(Uint8,
Input::MouseState
));
235
240
void
removeMouseUpCallback
(
void
(*fn)(Uint8,
Input::MouseState
));
241
246
void
addMouseMoveCallback
(
void
(*fn)(
Input::MouseState
));
247
252
void
removeMouseMoveCallback
(
void
(*fn)(
Input::MouseState
));
253
258
void
addJoyButtonDownCallback
(
void
(*fn)(Uint8,
JoyButton
));
259
264
void
removeJoyButtonDownCallback
(
void
(*fn)(Uint8,
JoyButton
));
265
270
void
addJoyButtonUpCallback
(
void
(*fn)(Uint8,
JoyButton
));
271
276
void
removeJoyButtonUpCallback
(
void
(*fn)(Uint8,
JoyButton
));
277
282
void
addJoyMoveCallback
(
void
(*fn)(Uint8,
JoyStick
,
Point2D
));
283
288
void
removeJoyMoveCallback
(
void
(*fn)(Uint8,
JoyStick
,
Point2D
));
289
294
static
bool
getAllPressed
(
InputAction
act);
295
301
static
bool
getAllTriggered
(
InputAction
act,
int
ms=-1);
302
308
static
Point2D
getAllMovement
(
InputAction
act =
Move
);
309
317
Point2D
getMovement
(
InputAction
act =
Move
);
318
324
bool
pressed
(
InputAction
act);
325
332
bool
triggered
(
InputAction
act,
int
ms=-1);
333
340
bool
doubleTapped
(
InputAction
act,
int
ms=-1);
341
342
343
protected
:
345
vector<WorldObject*>
mObjects
;
346
348
Input
*
mInput
;
349
351
map<InputAction, vector<SDLKey>>
mKeyMaps
;
352
354
map<InputAction, vector<JoyButton>>
mJoyButtonMaps
;
355
357
map<InputAction, vector<JoyStick>>
mJoyStickMaps
;
358
360
bool
useJoystick
;
361
};
362
#endif
Player.h
Generated on Tue Apr 16 2013 02:32:41 for The Game Engine by
1.8.3.1