GameKit  0.0.1a
C++ gamedev tools
GamePadMovement.cpp
Go to the documentation of this file.
1 /*
2  * =====================================================================================
3  *
4  * Filename: GamePadMovement.cpp
5  *
6  * Description:
7  *
8  * Created: 18/01/2018 02:42:00
9  *
10  * Author: Quentin Bazin, <quent42340@gmail.com>
11  *
12  * =====================================================================================
13  */
17 
18 namespace gk {
19 
21  auto &movementComponent = object.get<MovementComponent>();
22 
23  movementComponent.v.x = 0;
24  movementComponent.v.y = 0;
25 
27  movementComponent.v.x = -1;
28  }
29  else if(GamePad::isKeyPressed(m_right)) {
30  movementComponent.v.x = 1;
31  }
32 
34  movementComponent.v.y = -1;
35  }
36  else if(GamePad::isKeyPressed(m_down)) {
37  movementComponent.v.y = 1;
38  }
39 
40  m_isFinished = true;
41 }
42 
43 } // namespace gk
44 
static bool isKeyPressed(GameKey key)
Check if a key is pressed.
Definition: GamePad.cpp:20
bool m_isFinished
Definition: Movement.hpp:30
void process(SceneObject &object) override