Rally X
ELEN3009 Project by Justin Wernick and David Schneider
|
00001 #ifndef KEYBOARDHANDLER_H 00002 #define KEYBOARDHANDLER_H 00003 00004 #include <allegro5/allegro.h> 00005 00006 #include "../logic/Maze.h" 00007 #include "../logic/AllegroWrappers.h" 00008 00019 class KeyboardHandler 00020 { 00021 public: 00027 KeyboardHandler(Maze::Direction currentFacing); 00031 KeyboardHandler(const KeyboardHandler& ref); 00035 KeyboardHandler& operator=(const KeyboardHandler& rhs); 00039 ~KeyboardHandler(); 00040 00051 Maze::Direction getFacing(); 00052 00058 bool getSmokescreen(); 00059 00060 private: 00061 AllegroKeyboardInit _keyboard; 00062 00066 void updateFlags(); 00067 00068 bool _up; 00069 bool _down; 00070 bool _left; 00071 bool _right; 00072 bool _smokescreen; 00073 Maze::Direction _previousFacing; 00074 ALLEGRO_EVENT_QUEUE* _keyboardEvents; 00075 00076 static const int UP_KEY = ALLEGRO_KEY_UP; 00077 static const int DOWN_KEY = ALLEGRO_KEY_DOWN; 00078 static const int LEFT_KEY = ALLEGRO_KEY_LEFT; 00079 static const int RIGHT_KEY = ALLEGRO_KEY_RIGHT; 00080 static const int SMOKESCREEN_KEY = ALLEGRO_KEY_SPACE; 00081 }; 00082 00083 #endif // KEYBOARDHANDLER_H