FreeStick  0.3
Cross Platform Open Sorce Joystick Lib
FSDirectInputJoystick.h
Go to the documentation of this file.
1 /**************************************************************************
2 Created by Alan Uthoff on 10/8/2013
3 Copyright (C) 2015.
4 
5 This Code is free software; you can redistribute it and/or
6 modify it under the terms of the zlib/libpng License as published
7 by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9 This software is provided 'as-is', without any express or implied warranty.
10 
11 In no event will the authors be held liable for any damages arising from the use of this software.
12 
13 Permission is granted to anyone to use this software for any purpose,
14 including commercial applications, and to alter it and redistribute
15 it freely, subject to the following restrictions:
16 
17 1. The origin of this software must not be misrepresented;
18 you must not claim that you wrote the original software.
19 If you use this software in a product, an acknowledgment
20 in the product documentation would be appreciated but is not required.
21 
22 2. Altered source versions must be plainly marked as such,
23 and must not be misrepresented as being the original software.
24 
25 3. This notice may not be removed or altered from any source distribution.
26 **************************************************************************/
27 
28 #pragma once
29 #define DIRECTINPUT_VERSION 0x0800
30 #include <dinput.h>
31 
34 namespace freestick {
35 
37  {
38  public:
40  FSDirectInputJoystick(LPDIRECTINPUTDEVICE8 LPDIDJoystick,
41  idNumber joyStickID,
42  unsigned int numberOfButtons,
43  unsigned int numberOfAnlogSticks,
44  unsigned int numberOfDigitalSticks,
45  bool forceFeedBackSupported,
46  long vendorID,
47  long productID,
48  FSUSBJoystickDeviceManager & usbJoystickManager);
49  LPDIRECTINPUTDEVICE8 getDirectInputPtr(){return _LPDIDJoystick;}
50  virtual ~FSDirectInputJoystick();
52  void setCalibrated();
53  bool isCalibrated() const;
54  private:
55  LPDIRECTINPUTDEVICE8 _LPDIDJoystick;
56  FSUSBJoystickDeviceManager * _usbJoystickManager;
57  static BOOL CALLBACK EnumInputObjectsCallback( const DIDEVICEOBJECTINSTANCE* pdidoi,VOID* pContext );
58  long int getCurrentValue(FSDirectInputJoystick * device,const DIDEVICEOBJECTINSTANCE* pdidoi);
59  void addElement(long int usage, long int usagePage,minMaxNumber elementId,minMaxNumber min,minMaxNumber max,long int value);
60  bool calibrated = false;
61 
62  };
63 }
virtual FSDeviceType getClassType() const
Definition: FSDirectInputJoystick.h:51
Definition: IFSDevice.h:107
uint32_t idNumber
Definition: FSTypes.h:33
virtual ~FSDirectInputJoystick()
Definition: FSDirectInputJoystick.cpp:212
LPDIRECTINPUTDEVICE8 getDirectInputPtr()
Definition: FSDirectInputJoystick.h:49
Definition: FSBaseDevice.h:32
Definition: FSDirectInputJoystick.h:36
Definition: FSUSBJoystick.h:36
FSDeviceType
Definition: IFSDevice.h:100
FSDirectInputJoystick()
Definition: FSDirectInputJoystick.cpp:33
unsigned int numberOfButtons(IOHIDDeviceRef device)
Definition: FSUSBMacOSXJoystickDeviceManager.mm:282
Definition: FSUSBJoystickDeviceManager.h:34
int32_t minMaxNumber
Definition: FSTypes.h:34
bool isCalibrated() const
Definition: FSDirectInputJoystick.cpp:225
void setCalibrated()
Definition: FSDirectInputJoystick.cpp:220