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