MPMA Framework 0.4
WrapDInput.h
00001 //Wrap DirectInput calls to avoid directly polluting the global namespace of any of our real code with windows.h spam, since a lot of their names collide with ours.
00002 //Luke Lenhart, 2011
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 #include "../../base/Types.h"
00009 
00010 #if defined(MPMA_COMPILE_INPUT) && defined(ENABLE_GAME_DEVICE_INPUT)
00011 
00012 #include <list>
00013 #include <string>
00014 
00015 struct IDirectInputDevice8A;
00016 
00017 namespace INPUT_INTERNAL
00018 {
00019     bool DInput_Init();
00020 
00021     struct DeviceInfo
00022     {
00023         std::string DeviceName;
00024         std::string InstanceName;
00025         std::string PersistantIdentifier;
00026     };
00027 
00028     struct DeviceObject
00029     {
00030         inline DeviceObject(): Offset(-1) {}
00031 
00032         int Offset;
00033         std::string Name;
00034     };
00035 
00036     struct DeviceAxisSet
00037     {
00038         DeviceObject X;
00039         DeviceObject Y;
00040         DeviceObject Z;
00041     };
00042 
00043     struct DeviceAndObjects
00044     {
00045         inline DeviceAndObjects(): pCurrentStateData(0) {}
00046         ~DeviceAndObjects();
00047 
00048         DeviceInfo Info;
00049         IDirectInputDevice8A *pDev;
00050 
00051         std::list<DeviceObject> Buttons;
00052         std::list<DeviceObject> Hats;
00053         std::list<DeviceAxisSet> Axes;
00054 
00055         char *pCurrentStateData;
00056     };
00057 
00058     std::list<DeviceInfo> DInput_EnumGameDevices();
00059     DeviceAndObjects* DInput_CreateDevice(const DeviceInfo &device);
00060     void DInput_Device_Release(DeviceAndObjects *pWrappedDevice);
00061     bool DInput_Device_Poll(DeviceAndObjects* pWrappedDevice);
00062 }
00063 
00064 #endif //#if defined(MPMA_COMPILE_INPUT) && defined(ENABLE_GAME_DEVICE_INPUT)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends