FreeStick  0.3
Cross Platform Open Sorce Joystick Lib
FSXInputJoystick.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
30 #include <Windows.h>
31 #include <Xinput.h>
33 
34 #define UP_DPAD_XINPUT_EID 589836
35 #define DOWN_DPAD_XINPUT_EID 589837
36 #define LEFT_DPAD_XINPUT_EID 589838
37 #define RIGHT_DPAD_XINPUT_EID 589839
38 
39 #define A_BUTTON_XINPUT_EID 589825
40 #define B_BUTTON_XINPUT_EID 589826
41 #define X_BUTTON_XINPUT_EID 589827
42 #define Y_BUTTON_XINPUT_EID 589828
43 
44 #define BACK_BUTTON_XINPUT_EID 589834
45 #define START_BUTTON_XINPUT_EID 589833
46 #define CENTER_BUTTON_XINPUT_EID 589835
47 
48 #define LEFT_SHOULDER_BUTTON_XINPUT_EID 589829
49 #define RIGHT_SHOULDER_BUTTON_XINPUT_EID 589830
50 
51 #define LEFT_AXIS_BUTTON_XINPUT_EID 589831
52 #define RIGHT_AXIS_BUTTON_XINPUT_EID 589832
53 
54 #define XAXIS_XINPUT_EID 65584
55 #define YAXIS_XINPUT_EID 65585
56 
57 #define XAXIS2_XINPUT_EID 65587
58 #define YAXIS2_XINPUT_EID 65588
59 
60 #define LTRIGGER_XINPUT_EID 65586
61 #define RTRIGGER_XINPUT_EID 65589
62 
63 namespace freestick {
65  {
66  public:
67  FSXInputJoystick(XINPUT_STATE & state,
68  DWORD id, idNumber joyStickID,
69  unsigned int numberOfButtons,
70  unsigned int numberOfAnlogSticks,
71  unsigned int numberOfDigitalSticks,
72  bool forceFeedBackSupported,
73  long vendorID,
74  long productID,
75  FSUSBJoystickDeviceManager & usbJoystickManager);
76  void addXinputElements(XINPUT_STATE & state);
77  void addButtonElement(unsigned int buttonID);
78  void addElement(unsigned int buttonID,minMaxNumber min,minMaxNumber max,physicalValueNumber currentValue);
79  void setCalibrated();
80  bool isCalibrated() const;
81 
82  private:
83  DWORD id;
84  FSUSBJoystickDeviceManager * _usbJoystickManager = nullptr;
85  unsigned int _totalButtonNumber = 0;
86  bool calibrated = false;
87 
88 
89  };
90 }
Definition: FSXInputJoystick.h:64
void addXinputElements(XINPUT_STATE &state)
Definition: FSXInputJoystick.cpp:86
uint32_t idNumber
Definition: FSTypes.h:33
void addElement(unsigned int buttonID, minMaxNumber min, minMaxNumber max, physicalValueNumber currentValue)
Definition: FSXInputJoystick.cpp:69
FSXInputJoystick(XINPUT_STATE &state, DWORD id, idNumber joyStickID, unsigned int numberOfButtons, unsigned int numberOfAnlogSticks, unsigned int numberOfDigitalSticks, bool forceFeedBackSupported, long vendorID, long productID, FSUSBJoystickDeviceManager &usbJoystickManager)
Definition: FSXInputJoystick.cpp:33
Definition: FSBaseDevice.h:32
Definition: FSUSBJoystick.h:36
unsigned int numberOfButtons(IOHIDDeviceRef device)
Definition: FSUSBMacOSXJoystickDeviceManager.mm:282
void addButtonElement(unsigned int buttonID)
Definition: FSXInputJoystick.cpp:64
Definition: FSUSBJoystickDeviceManager.h:34
int32_t physicalValueNumber
Definition: FSTypes.h:35
void setCalibrated()
Definition: FSXInputJoystick.cpp:76
bool isCalibrated() const
Definition: FSXInputJoystick.cpp:81
int32_t minMaxNumber
Definition: FSTypes.h:34