Unified.h

Go to the documentation of this file.
00001 
00002 //Luke Lenhart, 2008
00003 //See /docs/License.txt for details on how this code may be used.
00004 
00005 #pragma once
00006 
00007 #include "../base/Setup.h"
00008 
00009 #ifdef MPMA_COMPILE_INPUT
00010 
00011 #include "../base/Types.h"
00012 
00013 #include <string>
00014 #include <vector>
00015 
00017 namespace INPUT
00018 {
00019     //Note that all input relies on the window being set up first.
00020 
00022     enum DeviceType
00023     {
00024         KEYBOARD_DEVICE=1,
00025         MOUSE_DEVICE,
00026         GAMEPAD_DEVICE
00027     };
00028 
00029     // -- buttons
00030 
00032     struct UnifiedButton
00033     {
00035         DeviceType Type;
00037         uint32 Data;
00038 
00040         inline UnifiedButton(DeviceType type, uint32 data)
00041         {
00042             Type=type;
00043             Data=data;
00044         }
00045 
00046         inline bool operator==(const UnifiedButton &o) const 
00047                 { return Type==o.Type && Data==o.Data; }
00048         inline bool operator!=(const UnifiedButton &o) const 
00049                 { return !(*this==o); }
00050     };
00051 
00053     bool IsButtonDown(const UnifiedButton &button);
00054 
00056     const std::vector<UnifiedButton>& GetCurrentlyPressedButtons();
00057 
00059     const std::vector<UnifiedButton>& GetNewlyPressedButtons();
00060 
00062     const std::string& GetFriendlyName(const UnifiedButton &button);
00063 
00064 
00065     // -- directions
00066     //(work in progress below)
00067 /*
00069     struct UnifiedAxisIdentifier
00070     {
00072         DeviceType Type;
00073 
00075         uint32 Identifier;
00076     };
00077 
00079     struct UnifiedAxisState
00080     {
00082         float X;
00083 
00085         float Y;
00086 
00088         float Z;
00089     };
00090 
00092     const std::vector<UnifiedAxisIdentifier>& GetAxisList();
00093 
00095     UnifiedAxisState GetAxisState(const UnifiedAxisIdentifier &axis);
00096 
00098     UnifiedAxisState GetCombinedAxisState();
00099 
00101     const std::string& GetFriendlyName(const UnifiedAxisIdentifier &axis);
00102 */
00103 }
00104 
00105 #endif //#ifdef MPMA_COMPILE_INPUT
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends