00001 #ifndef __INPUTMANAGER_H__ 00002 #define __INPUTMANAGER_H__ 00003 00004 #include <vector> 00005 00006 namespace NE 00007 { 00008 class Input; 00009 00010 // Unified (maybe limited) interface for all controllers 00011 class InputManager 00012 { 00013 public: 00014 00015 typedef int ArrowsDirection; 00016 typedef int Buttons; 00018 // Bit field definition for arrows direction 00019 static const ArrowsDirection AD_UP = 1; 00020 static const ArrowsDirection AD_UPRIGHT = 3; 00021 static const ArrowsDirection AD_RIGHT = 2; 00022 static const ArrowsDirection AD_RIGHTDOWN = 6; 00023 static const ArrowsDirection AD_DOWN = 4; 00024 static const ArrowsDirection AD_DOWNLEFT = 12; 00025 static const ArrowsDirection AD_LEFT = 8; 00026 static const ArrowsDirection AD_LEFTUP = 9; 00027 static const ArrowsDirection AD_NONE = 0; 00029 // Bit Field definition 00030 static const Buttons INPUT_NONE = 0; 00031 static const Buttons INPUT_A = 1; 00032 static const Buttons INPUT_B = 2; 00033 static const Buttons INPUT_X = 4; 00034 static const Buttons INPUT_Y = 8; 00035 static const Buttons INPUT_L = 16; 00036 static const Buttons INPUT_R = 32; 00037 static const Buttons INPUT_START = 64; 00038 static const Buttons INPUT_SELECT = 128; 00039 static const Buttons INPUT_VOLUMEUP = 256; 00040 static const Buttons INPUT_VOLUMEDOWN = 512; 00042 private: 00043 00044 std::vector<Input*> m_controllers; 00046 public: 00047 00048 InputManager(void); 00049 ~InputManager(void); 00050 00051 void registerController(NE::Input* newController); 00052 void deleteControllers(void); 00053 00054 ArrowsDirection getDirectionsPressed(void); 00055 Buttons getButtonsPressed(void); 00056 bool needEscape(void); 00057 void update(void); 00058 }; 00059 } 00060 00101 #endif