00001 00002 //Luke Lenhart, 2008 00003 //See /docs/License.txt for details on how this code may be used. 00004 00005 #pragma once 00006 #include "../base/Types.h" 00007 #include <string> 00008 #include <vector> 00009 00011 namespace INPUT 00012 { 00013 //Note that all input relies on the window being set up first. 00014 00016 enum DeviceType 00017 { 00018 KEYBOARD_DEVICE=1, 00019 MOUSE_DEVICE, 00020 GAMEPAD_DEVICE 00021 }; 00022 00023 // -- buttons 00024 00026 struct UnifiedButton 00027 { 00029 DeviceType Type; 00031 uint32 Data; 00032 00034 inline UnifiedButton(DeviceType type, uint32 data) 00035 { 00036 Type=type; 00037 Data=data; 00038 } 00039 00040 inline bool operator==(const UnifiedButton &o) const 00041 { return Type==o.Type && Data==o.Data; } 00042 inline bool operator!=(const UnifiedButton &o) const 00043 { return !(*this==o); } 00044 }; 00045 00047 bool IsButtonDown(const UnifiedButton &button); 00048 00050 const std::vector<UnifiedButton>& GetCurrentlyPressedButtons(); 00051 00053 const std::vector<UnifiedButton>& GetNewlyPressedButtons(); 00054 00056 const std::string& GetFriendlyName(const UnifiedButton &button); 00057 00058 00059 // -- directions 00060 //(work in progress below) 00061 /* 00063 struct UnifiedAxisIdentifier 00064 { 00066 DeviceType Type; 00067 00069 uint32 Identifier; 00070 }; 00071 00073 struct UnifiedAxisState 00074 { 00076 float X; 00077 00079 float Y; 00080 00082 float Z; 00083 }; 00084 00086 const std::vector<UnifiedAxisIdentifier>& GetAxisList(); 00087 00089 UnifiedAxisState GetAxisState(const UnifiedAxisIdentifier &axis); 00090 00092 UnifiedAxisState GetCombinedAxisState(); 00093 00095 const std::string& GetFriendlyName(const UnifiedAxisIdentifier &axis); 00096 */ 00097 }