From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/di__game__device_8h-source.html | 231 +++++++++++++++++++++++ 1 file changed, 231 insertions(+) create mode 100644 docs/doxygen/nel/di__game__device_8h-source.html (limited to 'docs/doxygen/nel/di__game__device_8h-source.html') diff --git a/docs/doxygen/nel/di__game__device_8h-source.html b/docs/doxygen/nel/di__game__device_8h-source.html new file mode 100644 index 00000000..0e2debf7 --- /dev/null +++ b/docs/doxygen/nel/di__game__device_8h-source.html @@ -0,0 +1,231 @@ + + + + nevrax.org : docs + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
+
+ + +
+ + +
+Docs + +
+  + + + + + +
Documentation 
+ +
+Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  
+

di_game_device.h

Go to the documentation of this file.
00001 
+00007 /* Copyright, 2000-2002 Nevrax Ltd.
+00008  *
+00009  * This file is part of NEVRAX NEL.
+00010  * NEVRAX NEL is free software; you can redistribute it and/or modify
+00011  * it under the terms of the GNU General Public License as published by
+00012  * the Free Software Foundation; either version 2, or (at your option)
+00013  * any later version.
+00014 
+00015  * NEVRAX NEL is distributed in the hope that it will be useful, but
+00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
+00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+00018  * General Public License for more details.
+00019 
+00020  * You should have received a copy of the GNU General Public License
+00021  * along with NEVRAX NEL; see the file COPYING. If not, write to the
+00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+00023  * MA 02111-1307, USA.
+00024  */
+00025 
+00026 #ifndef NL_DI_GAME_DEVICE_H
+00027 #define NL_DI_GAME_DEVICE_H
+00028 
+00029 #include "nel/misc/types_nl.h"
+00030 
+00031 #ifdef NL_OS_WINDOWS
+00032 
+00033 #include "nel/misc/di_event_emitter.h"
+00034 #include "nel/misc/game_device.h"
+00035 
+00036 namespace NLMISC 
+00037 {
+00038 
+00039 //
+00040 typedef DIJOYSTATE2 CDIJoyState;
+00041 const   DIDATAFORMAT * const pJoyDataFormat = &c_dfDIJoystick2;
+00042 const   uint MaxNumSliders = 2;
+00043 const   uint MaxNumPOVs = 4;
+00044 const   uint MaxNumButtons = 128;
+00045 //
+00046 
+00047 struct EDirectInputGameDeviceNotCreated : EDirectInput
+00048 {
+00049         EDirectInputGameDeviceNotCreated() : EDirectInput("Unable to create a game device") {}
+00050 };
+00051 
+00052 
+00057 class CDIGameDevice : public IGameDevice
+00058 {
+00059 public:
+00061         static CDIGameDevice *createGameDevice(IDirectInput8 *di8,
+00062                                                                                    HWND hwnd,
+00063                                                                                    CDIEventEmitter *diEventEmitter,
+00064                                                                                    const CGameDeviceDesc &desc,
+00065                                                                                    REFGUID rguid) throw(EDirectInput);
+00066         ~CDIGameDevice();
+00067 
+00069 
+00070                 virtual bool            setBufferSize(uint size);
+00071                 virtual uint            getBufferSize() const;
+00073 
+00075 
+00076                 virtual const           CGameDeviceDesc &getDescription()  const { return _Desc; }                                                      
+00077                 //      
+00078                 virtual uint            getNumButtons() const;          
+00079                 virtual bool            hasAxis(TAxis axis) const;              
+00080                 virtual uint            getNumSliders() const;          
+00081                 virtual uint            getNumPOV() const;
+00082                 //
+00083                 virtual const char *getButtonName(uint index) const;
+00084                 virtual const char *getAxisName(TAxis axis) const;
+00085                 virtual const char *getSliderName(uint index) const;
+00086                 virtual const char *getPOVName(uint index) const;
+00087                 //
+00088                 virtual bool            getButtonState(uint index) const;
+00089                 virtual float           getAxisValue(TAxis axis) const;
+00090                 virtual float           getSliderPos(uint index) const;
+00091                 virtual float           getPOVAngle(uint index) const;
+00093 
+00094 
+00097 private:        
+00098 
+00099         // base class for controls
+00100         struct CCtrl
+00101         {               
+00102                 std::string Name;
+00103         };
+00104 
+00105         // a button
+00106         struct CButton  : public CCtrl
+00107         {               
+00108                 bool            Pushed;
+00109                 CButton() : Pushed(false) {}
+00110         };
+00111 
+00112         // an axis. Its value either gives its position (-1 .. 1) or its angle (CCW in radians)
+00113         struct CAxis    : public CCtrl
+00114         {       
+00115                 bool            Present; // is this axis used ?
+00116                 // min and max values from Direct Input
+00117                 sint        Min, Max;
+00118                 float           Value;
+00119                 CAxis() : Value(0.f), Present(false) {}
+00120         };
+00121 
+00122         // a slider
+00123         struct CSlider  : public CCtrl
+00124         {
+00125                 sint        Min, Max;
+00126                 float Pos;
+00127                 CSlider() : Pos(0.f) {}
+00128         };
+00129 
+00130         // a POV
+00131         struct CPOV     : public CCtrl
+00132         {
+00133                 bool  Centered;
+00134                 float Angle;
+00135                 CPOV() : Angle(0.f), Centered(true) {}
+00136         };
+00137                 
+00138         
+00139 private:
+00140         // ctor
+00141         CDIGameDevice();
+00143 
+00144                 virtual void begin(CEventServer *server);
+00145                 virtual void poll(CInputDeviceServer *dev);             
+00146                 virtual void submit(IInputDeviceEvent *deviceEvent, CEventServer *server);              
+00148 
+00150         void    querryControls();
+00151         
+00153         BOOL    processEnumObject(LPCDIDEVICEOBJECTINSTANCE lpddoi);
+00154         friend  BOOL CALLBACK DIEnumDeviceObjectsCallback(LPCDIDEVICEOBJECTINSTANCE lpddoi,  LPVOID pvRef);
+00155 private:
+00156         LPDIRECTINPUTDEVICE8    _Device;
+00157         CGameDeviceDesc                 _Desc;
+00158         CDIEventEmitter                 *_EventEmitter;
+00159         
+00161 
+00162                 CAxis                                   _Axis[MaxNumAxis];
+00163                 std::vector<CButton>    _Buttons;
+00164                 std::vector<CSlider>    _Sliders;
+00165                 std::vector<CPOV>               _POVs;
+00167         CDIJoyState                                     _CurrentState;
+00168         
+00169 };
+00170 
+00171 
+00172 } // NLMISC
+00173 
+00174 #endif // NL_OS_WINDOWS
+00175 
+00176 
+00177 #endif // NL_DI_GAME_DEVICE_H
+00178 
+00179 /* End of di_play_device.h */
+
+ + +
                                                                                                                                                                    +
+ + -- cgit v1.2.1