PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: SpaceMouse.h * 00003 * 00004 * Copyright (C) 2002-2011 The PixelLight Team (http://www.pixellight.org/) 00005 * 00006 * This file is part of PixelLight. 00007 * 00008 * PixelLight is free software: you can redistribute it and/or modify 00009 * it under the terms of the GNU Lesser General Public License as published by 00010 * the Free Software Foundation, either version 3 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * PixelLight is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public License 00019 * along with PixelLight. If not, see <http://www.gnu.org/licenses/>. 00020 \*********************************************************/ 00021 00022 00023 #ifndef __PLINPUT_SPACEMOUSE_H__ 00024 #define __PLINPUT_SPACEMOUSE_H__ 00025 #pragma once 00026 00027 00028 //[-------------------------------------------------------] 00029 //[ Includes ] 00030 //[-------------------------------------------------------] 00031 #include <PLCore/Base/Event/EventHandler.h> 00032 #include "PLInput/Input/Controls/Axis.h" 00033 #include "PLInput/Input/Controls/Button.h" 00034 #include "PLInput/Input/Devices/Device.h" 00035 00036 00037 //[-------------------------------------------------------] 00038 //[ Namespace ] 00039 //[-------------------------------------------------------] 00040 namespace PLInput { 00041 00042 00043 //[-------------------------------------------------------] 00044 //[ Forward declarations ] 00045 //[-------------------------------------------------------] 00046 class HIDDevice; 00047 00048 00049 //[-------------------------------------------------------] 00050 //[ Classes ] 00051 //[-------------------------------------------------------] 00052 /** 00053 * @brief 00054 * SpaceMouse input device 00055 * 00056 * @remarks 00057 * This class supports the following device backend types: 00058 * - HIDDevice 00059 */ 00060 class SpaceMouse : public Device { 00061 00062 00063 //[-------------------------------------------------------] 00064 //[ Class definition ] 00065 //[-------------------------------------------------------] 00066 pl_class(PLINPUT_RTTI_EXPORT, SpaceMouse, "PLInput", PLInput::Device, "Joystick input controller") 00067 pl_class_end 00068 00069 00070 //[-------------------------------------------------------] 00071 //[ Public definitions ] 00072 //[-------------------------------------------------------] 00073 public: 00074 /** 00075 * @brief 00076 * SpaceMouse IDs 00077 * 00078 * @remarks 00079 * It is not recommended to use the ProductID, because it's different for each individual product (NOT future safe) 00080 */ 00081 enum EProductID { 00082 VendorID = 1133, /**< '3DConnexion' */ 00083 SpaceMousePlus_ProductID = 0xc603, /**< 'SpaceMousePlus' */ 00084 SpaceBall_ProductID = 0xc621, /**< 'SpaceBall' */ 00085 SpaceTraveler_ProductID = 0xc623, /**< 'SpaceTraveler' */ 00086 SpacePilot_ProductID = 0xc625, /**< 'SpacePilot' */ 00087 SpaceNavigator_ProductID = 0xc626, /**< 'SpaceNavigator' */ 00088 SpaceExplorer_ProductID = 0xc627 /**< 'SpaceExplorer' */ 00089 }; 00090 00091 00092 //[-------------------------------------------------------] 00093 //[ Controller definition ] 00094 //[-------------------------------------------------------] 00095 public: 00096 PLInput::Axis TransX; /**< Absolute x translation axis (the values are usually roughly between [-400 .. 400]) */ 00097 PLInput::Axis TransY; /**< Absolute y translation axis (the values are usually roughly between [-400 .. 400]) */ 00098 PLInput::Axis TransZ; /**< Absolute z translation axis (the values are usually roughly between [-400 .. 400]) */ 00099 PLInput::Axis RotX; /**< Absolute x rotation axis (the values are usually roughly between [-400 .. 400]) */ 00100 PLInput::Axis RotY; /**< Absolute y rotation axis (the values are usually roughly between [-400 .. 400]) */ 00101 PLInput::Axis RotZ; /**< Absolute z rotation axis (the values are usually roughly between [-400 .. 400]) */ 00102 PLInput::Button Button0; /**< Button #0 */ 00103 PLInput::Button Button1; /**< Button #1 */ 00104 PLInput::Button Button2; /**< Button #2 */ 00105 PLInput::Button Button3; /**< Button #3 */ 00106 PLInput::Button Button4; /**< Button #4 */ 00107 PLInput::Button Button5; /**< Button #5 */ 00108 PLInput::Button Button6; /**< Button #6 */ 00109 PLInput::Button Button7; /**< Button #7 */ 00110 00111 00112 //[-------------------------------------------------------] 00113 //[ Public functions ] 00114 //[-------------------------------------------------------] 00115 public: 00116 /** 00117 * @brief 00118 * Constructor 00119 * 00120 * @param[in] sName 00121 * Device name 00122 * @param[in] pImpl 00123 * System specific device implementation, can, but shouldn't be a null pointer 00124 */ 00125 PLINPUT_API SpaceMouse(const PLCore::String &sName, DeviceImpl *pImpl); 00126 00127 /** 00128 * @brief 00129 * Destructor 00130 */ 00131 PLINPUT_API virtual ~SpaceMouse(); 00132 00133 00134 //[-------------------------------------------------------] 00135 //[ Private functions ] 00136 //[-------------------------------------------------------] 00137 private: 00138 /** 00139 * @brief 00140 * Called when the HID device has read some data 00141 */ 00142 void OnDeviceRead(); 00143 00144 00145 //[-------------------------------------------------------] 00146 //[ Private data ] 00147 //[-------------------------------------------------------] 00148 private: 00149 // Event handlers 00150 PLCore::EventHandler<> EventHandlerOnDeviceRead; 00151 00152 // HID connection 00153 HIDDevice *m_pHIDDevice; /**< HID device */ 00154 00155 00156 }; 00157 00158 00159 //[-------------------------------------------------------] 00160 //[ Namespace ] 00161 //[-------------------------------------------------------] 00162 } // PLInput 00163 00164 00165 #endif // __PLINPUT_SPACEMOUSE_H__
|