1 #ifndef PLAYER_H_DEFINED
2 #define PLAYER_H_DEFINED
8 #include <btBulletDynamicsCommon.h>
10 const unsigned int WALL_QUERY_MASK
= 0x00000001;
11 const unsigned int PLAYER_QUERY_MASK
= 0x00000010;
12 const unsigned int BULLET_QUERY_MASK
= 0x00000100;
14 #define MAX_BULLETS 50
18 typedef struct bullet
{
26 const Vector3 cube_size
, bullet_size
;
28 SceneManager
*sceneMgr
;
29 Entity
*tmp_ent
; //tmp debug
32 std::vector
<Bullet
> bullets
;
33 AxisAlignedBoxSceneQuery
*bullet_query
;
37 SceneNode
*bullet_node
;
43 OIS::KeyCode key_up
,key_down
,key_left
,key_right
,key_fire
;
45 Bullet
*getBulletByNode(SceneNode
*node
);
51 void init(SceneManager
*sm
, const std::string
&name
);
53 void setKeys(OIS::KeyCode up
, OIS::KeyCode down
, OIS::KeyCode left
, OIS::KeyCode right
, OIS::KeyCode fire
);
54 OIS::KeyCode
getKeyUp() {return key_up
;};
55 OIS::KeyCode
getKeyDown() {return key_down
;};
56 OIS::KeyCode
getKeyLeft() {return key_left
;};
57 OIS::KeyCode
getKeyRight() {return key_right
;};
58 OIS::KeyCode
getKeyFire() {return key_fire
;};
60 const float getSpeed() {return speed
;};
61 const float getTurnSpeed() {return turn_speed
;};
63 void setPos(Vector3 p
);
64 void setDir(Vector3 d
);
65 const Vector3
& getPos();
72 void fire(btDynamicsWorld
*col_world
);
73 void aim(const Vector3
&p
); // aim at point
75 void preupdate(float dt
);
76 void postupdate(float dt
);
78 btRigidBody
* getBody() {return body
;};