PROTO::KLUDGE  0.1
Quick prototyping library for games using SDL and OpenGL.
CharacterController.hpp
Go to the documentation of this file.
1 #ifndef CHARACTERCONTROLLER_HPP
2 #define CHARACTERCONTROLLER_HPP
3 
4 #include <vector>
5 #include <algorithm>
6 
7 #include "core/Game.hpp"
9 #include "graphics/GLSprite.hpp"
11 #include "gameplay/Bullet.hpp"
12 
13 namespace pk
14 {
15 
17 {
18  public:
20 
21  CharacterController(b2World* world, GLTexture& texture, int player, GLRect rect);
22 
23  virtual ~CharacterController();
24 
25  std::vector<pk::Bullet>& getBullets(){ return m_bullets; };
26 
27  bool requestPause(){ return m_paused; }
28 
29  void handleInput();
30 
31  void update();
32 
33  GLSprite& getSprite(){ return m_sprite; };
34 
35  int getPlayerID(){ return m_playerID; };
36 
37  void BeginContact(b2Contact* contact) override;
38 
39  void EndContact(b2Contact* contact) override;
40 
41  private:
42  b2World* m_world;
45  std::vector<pk::Bullet> m_bullets;
46 
60  unsigned int m_fireCounter;
61  double m_fireTime;
62  double m_fireDelay;
64  float m_velocity;
65  double m_jumpTime;
66  double m_jumpDelay;
70  bool m_paused;
71  double m_pauseTimer;
72  Mix_Chunk* m_shotSound;
73  Mix_Chunk* m_jumpSound;
74  Mix_Chunk* m_dashSound;
75 };
76 
77 }
78 
79 #endif // CHARACTERCONTROLLER_HPP
pk::CharacterBody m_body
Definition: CharacterController.hpp:44
Definition: Game.hpp:7
double m_fireDelay
Definition: CharacterController.hpp:62
pk::GameController m_controller
Definition: CharacterController.hpp:47
virtual ~CharacterController()
Mix_Chunk * m_dashSound
Definition: CharacterController.hpp:74
void EndContact(b2Contact *contact) override
bool m_pressedRightShoulder
Definition: CharacterController.hpp:58
bool requestPause()
Definition: CharacterController.hpp:27
b2World * m_world
Definition: CharacterController.hpp:42
Mix_Chunk * m_jumpSound
Definition: CharacterController.hpp:73
void BeginContact(b2Contact *contact) override
bool m_pressedLeft
Definition: CharacterController.hpp:51
double m_pauseTimer
Definition: CharacterController.hpp:71
double m_fireTime
Definition: CharacterController.hpp:61
float m_dashVelocity
Definition: CharacterController.hpp:68
int m_playerID
Definition: CharacterController.hpp:48
float m_fireVelocity
Definition: CharacterController.hpp:63
float m_velocity
Definition: CharacterController.hpp:64
A class representing a Box2D dynamic body with special fixtures and data used to track collisions and...
Definition: CharacterBody.hpp:25
double m_jumpDelay
Definition: CharacterController.hpp:66
bool m_pressedRightTrigger
Definition: CharacterController.hpp:56
pk::GLSprite m_sprite
Definition: CharacterController.hpp:43
double m_jumpTime
Definition: CharacterController.hpp:65
bool m_pressedPause
Definition: CharacterController.hpp:69
std::vector< pk::Bullet > m_bullets
Definition: CharacterController.hpp:45
Mix_Chunk * m_shotSound
Definition: CharacterController.hpp:72
bool m_pressedUp
Definition: CharacterController.hpp:53
Useful for defining size and origin of an OpenGL object.
Definition: GLTransformable.hpp:15
bool m_pressedLeftShoulder
Definition: CharacterController.hpp:57
int getPlayerID()
Definition: CharacterController.hpp:35
Definition: CharacterController.hpp:16
unsigned int m_fireCounter
Definition: CharacterController.hpp:60
bool m_pressedFire
Definition: CharacterController.hpp:49
GLSprite & getSprite()
Definition: CharacterController.hpp:33
std::vector< pk::Bullet > & getBullets()
Definition: CharacterController.hpp:25
bool m_pressedLeftTrigger
Definition: CharacterController.hpp:55
bool m_pressedDown
Definition: CharacterController.hpp:54
int m_facingDirection
Definition: CharacterController.hpp:59
Class for creating textures usable with OpenGL from SDL.
Definition: GLTexture.hpp:57
bool m_pressedJump
Definition: CharacterController.hpp:50
Convenience class for abstracting functionality that already exists in SDL.
Definition: GameController.hpp:61
bool m_pressedRight
Definition: CharacterController.hpp:52
bool m_paused
Definition: CharacterController.hpp:70
float m_jumpVelocity
Definition: CharacterController.hpp:67
Definition: GLSprite.hpp:13