00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef NL_GAME_DEVICE_H
00027 #define NL_GAME_DEVICE_H
00028
00029 #include "nel/misc/types_nl.h"
00030 #include "nel/misc/input_device.h"
00031 #include <string>
00032 #include <vector>
00033
00034
00035 namespace NLMISC
00036 {
00037
00039 struct CGameDeviceDesc
00040 {
00041
00042 enum TDevType { GamePad, Joystick, DontKnow, DevTypeLast } DevType;
00043
00044 std::string InstanceName;
00045
00046 std::string ProductName;
00047
00048 bool Connected;
00049 };
00050
00051
00052 typedef std::vector<CGameDeviceDesc> TDeviceDescVect;
00053
00055 inline bool operator == (const CGameDeviceDesc &lhs, const CGameDeviceDesc &rhs)
00056 {
00057 return lhs.InstanceName == rhs.InstanceName && lhs.ProductName == rhs.ProductName;
00058 }
00059
00060 inline bool operator != (const CGameDeviceDesc &lhs, const CGameDeviceDesc &rhs)
00061 {
00062 return !(lhs == rhs);
00063 }
00064
00065
00072 struct IGameDevice : public IInputDevice
00073 {
00074 enum TAxis { XAxis = 0, YAxis, ZAxis,
00075 RXAxis, RYAxis, RZAxis,
00076 MaxNumAxis
00077 };
00078
00080 virtual const CGameDeviceDesc &getDescription() const = 0;
00081
00083
00084
00085 virtual uint getNumButtons() const = 0;
00089 virtual bool hasAxis(TAxis axis) const = 0;
00090
00091 virtual uint getNumSliders() const = 0;
00092
00093 virtual uint getNumPOV() const = 0;
00095
00097
00098 virtual const char *getButtonName(uint index) const = 0;
00099 virtual const char *getAxisName(TAxis axis) const = 0;
00100 virtual const char *getSliderName(uint index) const = 0;
00101 virtual const char *getPOVName(uint index) const = 0;
00103
00105
00106
00107 virtual bool getButtonState(uint index) const = 0;
00108
00109 virtual float getAxisValue(TAxis axis) const = 0;
00110
00111 virtual float getSliderPos(uint index) const = 0;
00112
00113 virtual float getPOVAngle(uint index) const = 0;
00115 };
00116
00117
00118 }
00119
00120
00121 #endif // NL_GAME_DEVICE_H
00122
00123