CGamePad.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include <ionMath.h>
5 #include <ionFramework.h>
6 
7 
8 namespace ion
9 {
10 
11  enum class EGamePadButton
12  {
13  A,
14  B,
15  X,
16  Y,
19  DPadUp,
20  DPadDown,
21  DPadLeft,
22  DPadRight,
23  Start,
24  Back,
25  LeftThumb,
26  RightThumb,
27  Count
28  };
29 
30  class CGamePad : public IEventListener, public Singleton<CGamePad>
31  {
32 
33  protected:
34 
39  bool ButtonPressed[(int) EGamePadButton::Count];
40 
41  public:
42 
43  vec2f const & GetLeftStick() const;
44  vec2f const & GetRightStick() const;
45  f32 GetLeftTrigger() const;
46  f32 GetRightTrigger() const;
47  bool IsButtonPressed(EGamePadButton const Button);
48 
49  void UpdateState();
50 
51 
52  private:
53 
54  friend class Singleton<CGamePad>;
55  CGamePad();
56 
57  };
58 
59  struct SGamePadButtonEvent : public IEvent
60  {
61  bool Pressed = false;
63  CGamePad * GamePad = nullptr;
64  };
65 
66 }
f32 RightTrigger
Definition: CGamePad.h:38
EGamePadButton Button
Definition: CGamePad.h:62
Definition: CGamePad.h:30
vec2f RightStick
Definition: CGamePad.h:36
EGamePadButton
Definition: CGamePad.h:11
float f32
Definition: ionTypes.h:94
Definition: CCatmullRomAdvancedSplineInterpolator.h:7
Definition: IEvent.h:7
f32 LeftTrigger
Definition: CGamePad.h:37
Definition: IEventListener.h:8
Base class for Singleton design pattern implementation.
Definition: ionClass.h:90
Definition: CGamePad.h:59
vec2f LeftStick
Definition: CGamePad.h:35