LPCGame
A Simple 2d Game Engine
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
input.h
1 #ifndef INPUT_H
2 #define INPUT_H
3 
4 #include <memory>
5 #include <string>
6 #include <SDL.h>
7 #include "base.h"
8 
10 enum MOUSE { LEFT = 1, MIDDLE = 2, RIGHT = 3 };
11 
13 
16 class Input {
17 public:
18  Input();
19  ~Input();
21  static void Init();
23  static void PollEvent();
24  //Functions for interacting with keyboard
30  static bool KeyDown(std::string keyCode);
36  static bool KeyDown(int keyCode);
37  //Functions for interacting with mouse
42  static bool MouseClick(int button);
47  static bool MouseDown(int button);
49  static SDL_MouseButtonEvent GetClick();
51  static bool MouseMotion();
53  static SDL_MouseMotionEvent GetMotion();
55  static Vector2f MousePos();
56  //Functions for interacting with Joystick
63  static float GetJoyAxis(int axis);
69  static bool GetJoyButton(int button);
75  static int GetJoyHat(int hat);
77  static bool JoystickAvailable();
79  static bool JoySupportsHaptic();
81  static bool Quit();
83  static void Clear();
85  static void Close();
86 
87 private:
88  static void ClearQuit();
90  static void ClearKeys();
92  static void ClearMouse();
93 
94 private:
95  static SDL_Event evt;
96  static bool mQuit, mMouseMove, mMouseClick;
97  static Uint8 *mKeyStates;
98  static SDL_Joystick *mJoystick;
99  static SDL_MouseButtonEvent mButtonEvt;
100  static SDL_MouseMotionEvent mMotionEvt;
101 };
102 
103 #endif