AntiMicroX
gamecontrollertrigger.h
Go to the documentation of this file.
1 /* antimicrox Gamepad to KB+M event mapper
2  * Copyright (C) 2015 Travis Nickles <nickles.travis@gmail.com>
3  * Copyright (C) 2020 Jagoda Górska <juliagoda.pl@protonmail>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9 
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14 
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef GAMECONTROLLERTRIGGER_H
20 #define GAMECONTROLLERTRIGGER_H
21 
22 #include "joyaxis.h"
23 
24 class HapticTriggerPs5;
25 class QXmlStreamReader;
26 class QXmlStreamWriter;
27 class SetJoystick;
28 
30 {
31  Q_OBJECT
32 
33  public:
34  explicit GameControllerTrigger(int index, int originset, SetJoystick *parentSet, QObject *parent = nullptr);
35 
36  virtual QString getXmlName(); // GameControllerTriggerXml class
37  virtual QString getPartialName(bool forceFullFormat, bool displayNames);
38 
39  virtual int getDefaultDeadZone();
40  virtual int getDefaultMaxZone();
42 
44 
45  virtual bool hasHapticTrigger() const override;
46  virtual HapticTriggerPs5 *getHapticTrigger() const override;
47  virtual void setHapticTriggerMode(HapticTriggerModePs5 mode) override;
48 
49  public slots:
50  virtual void reset();
51  virtual void reset(int index);
52 
53  protected:
55 
57 };
58 
59 #endif // GAMECONTROLLERTRIGGER_H
JoyAxis::paxisbutton
JoyAxisButton * paxisbutton
Definition: joyaxis.h:169
JoyAxis::setThrottle
void setThrottle(int value)
Set throttle value for axis.
Definition: joyaxis.cpp:388
GameControllerTrigger::setHapticTriggerMode
virtual void setHapticTriggerMode(HapticTriggerModePs5 mode) override
Changes the haptic feedback effect mode.
Definition: gamecontrollertrigger.cpp:185
GlobalVariables::HapticTriggerPs5::RIGIDGRADIENTSTRENGTH
static const int RIGIDGRADIENTSTRENGTH
Definition: globalvariables.h:132
GameControllerTrigger::getDefaultMaxZone
virtual int getDefaultMaxZone()
Definition: gamecontrollertrigger.cpp:130
JoyAxis::activeButton
JoyAxisButton * activeButton
Definition: joyaxis.h:191
JoyAxis::setCurrentRawValue
void setCurrentRawValue(int value)
Definition: joyaxis.cpp:581
JoyAxis
Represents single axis of of joystick (or other input)
Definition: joyaxis.h:40
JoyAxis::getRealJoyIndex
int getRealJoyIndex()
Definition: joyaxis.cpp:251
JoyAxis::naxisbutton
JoyAxisButton * naxisbutton
Definition: joyaxis.h:170
HAPTIC_TRIGGER_CLICK
@ HAPTIC_TRIGGER_CLICK
Definition: haptictriggermodeps5.h:25
globalvariables.h
JoyAxis::pendingValue
int pendingValue
Definition: joyaxis.h:184
JoyAxis::throttle
int throttle
Definition: joyaxis.h:175
joyaxisxml.h
gamecontrollertrigger.h
SetJoystick
A set of mapped events which can by switched by a controller event. Contains controller input objects...
Definition: setjoystick.h:39
JoyAxis::isActive
bool isActive
Definition: joyaxis.h:186
JoyAxis::pendingEvent
bool pendingEvent
Definition: joyaxis.h:187
JoyAxis::calculateThrottledValue
int calculateThrottledValue(int value)
Definition: joyaxis.cpp:257
JoyAxis::currentRawValue
int currentRawValue
Definition: joyaxis.h:178
GlobalVariables::GameControllerTrigger::AXISMAXZONE
static const int AXISMAXZONE
Definition: globalvariables.h:168
GlobalVariables::HapticTriggerPs5::VIBRATIONSTRENGTH
static const int VIBRATIONSTRENGTH
Definition: globalvariables.h:133
GameControllerTrigger::getDefaultThrottle
virtual ThrottleTypes getDefaultThrottle()
Definition: gamecontrollertrigger.cpp:132
JoyAxis::axisName
QString axisName
Definition: joyaxis.h:172
JoyAxis::eventActive
bool eventActive
Definition: joyaxis.h:189
InputDevice::getControllerType
virtual SDL_GameControllerType getControllerType() const
Returns the current controller model. For non gamecontroller devices it always returns UNKNOWN.
Definition: inputdevice.cpp:1733
haptictriggerps5.h
JoyAxis::currentThrottledValue
int currentThrottledValue
Definition: joyaxis.h:179
JoyAxis::currentThrottledDeadValue
int currentThrottledDeadValue
Definition: joyaxis.h:180
JoyAxis::lastKnownRawValue
int lastKnownRawValue
Definition: joyaxis.h:183
GameControllerTrigger
Definition: gamecontrollertrigger.h:29
JoyAxis::pendingIgnoreSets
bool pendingIgnoreSets
Definition: joyaxis.h:188
GlobalVariables::GameControllerTrigger::AXISDEADZONE
static const int AXISDEADZONE
Definition: globalvariables.h:167
GameControllerTrigger::reset
virtual void reset()
Definition: gamecontrollertrigger.cpp:61
HAPTIC_TRIGGER_RIGID
@ HAPTIC_TRIGGER_RIGID
Definition: haptictriggermodeps5.h:26
HAPTIC_TRIGGER_RIGID_GRADIENT
@ HAPTIC_TRIGGER_RIGID_GRADIENT
Definition: haptictriggermodeps5.h:27
gamecontrollertriggerbutton.h
JoyAxis::PositiveHalfThrottle
@ PositiveHalfThrottle
Definition: joyaxis.h:54
inputdevice.h
GlobalVariables::HapticTriggerPs5::RANGE
static const int RANGE
Definition: globalvariables.h:134
GameControllerTrigger::getHapticTrigger
virtual HapticTriggerPs5 * getHapticTrigger() const override
Recalculates haptic trigger effect positions, e.g. after dead zone change, and returns the current Ha...
Definition: gamecontrollertrigger.cpp:148
GlobalVariables::GameControllerTrigger::xmlName
static const QString xmlName
Definition: globalvariables.h:170
GlobalVariables::JoyAxis::AXISMAX
static const int AXISMAX
Definition: globalvariables.h:118
HAPTIC_TRIGGER_NONE
@ HAPTIC_TRIGGER_NONE
Definition: haptictriggermodeps5.h:24
GlobalVariables::HapticTriggerPs5::RIGIDSTRENGTH
static const int RIGIDSTRENGTH
Definition: globalvariables.h:131
HapticTriggerModePs5
HapticTriggerModePs5
Enum of the supported haptic trigger effect for a PS5 controller.
Definition: haptictriggermodeps5.h:22
GameControllerTrigger::correctJoystickThrottle
void correctJoystickThrottle()
Definition: gamecontrollertrigger.cpp:117
GameControllerTrigger::getDefaultDeadZone
virtual int getDefaultDeadZone()
Definition: gamecontrollertrigger.cpp:128
JoyAxis::adjustRange
void adjustRange()
Definition: joyaxis.cpp:465
GameControllerTrigger::m_haptic_trigger
HapticTriggerPs5 * m_haptic_trigger
Definition: gamecontrollertrigger.h:56
GlobalVariables::HapticTriggerPs5::FREQUENCY
static const int FREQUENCY
Definition: globalvariables.h:135
JoyAxis::defaultAxisName
QString defaultAxisName
Definition: joyaxis.h:173
joyaxis.h
SetJoystick::getInputDevice
InputDevice * getInputDevice() const
Definition: setjoystick.cpp:931
GameControllerTrigger::GameControllerTrigger
GameControllerTrigger(int index, int originset, SetJoystick *parentSet, QObject *parent=nullptr)
Definition: gamecontrollertrigger.cpp:39
JoyAxis::ThrottleTypes
ThrottleTypes
Definition: joyaxis.h:48
setjoystick.h
JoyButton::reset
virtual void reset()
Definition: joybutton.cpp:391
GameControllerTrigger::getPartialName
virtual QString getPartialName(bool forceFullFormat, bool displayNames)
Definition: gamecontrollertrigger.cpp:88
HapticTriggerPs5::set_effect
bool set_effect(int strength, int start, int end, int frequency=0)
Changes the haptic feedback effect.
Definition: haptictriggerps5.cpp:265
GlobalVariables::HapticTriggerPs5::CLICKSTRENGTH
static const int CLICKSTRENGTH
Definition: globalvariables.h:130
HapticTriggerPs5::get_mode
HapticTriggerModePs5 get_mode() const
Returns the current haptic feedback effect mode.
Definition: haptictriggerps5.cpp:243
GameControllerTrigger::getXmlName
virtual QString getXmlName()
Definition: gamecontrollertrigger.cpp:86
GameControllerTrigger::DEFAULTTHROTTLE
static const ThrottleTypes DEFAULTTHROTTLE
Definition: gamecontrollertrigger.h:43
GameControllerTriggerButton
Definition: gamecontrollertriggerbutton.h:28
JoyAxis::lastKnownThottledValue
int lastKnownThottledValue
Definition: joyaxis.h:182
number
it is up to the author donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License If the distribution and or use of the Library is restricted in certain countries either by patents or by copyrighted the original copyright holder who places the Library under this License may add an geographical distribution limitation excluding those so that distribution is permitted only in or among countries not thus excluded In such this License incorporates the limitation as if written in the body of this License The Free Software Foundation may publish revised and or new versions of the Lesser General Public License from time to time Such new versions will be similar in spirit to the present but may differ in detail to address new problems or concerns Each version is given a distinguishing version number If the Library specifies a version number of this License which applies to it and any later you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation If the Library does not specify a license version number
Definition: lgpl-2.1.txt:423
JoyAxis::deadZone
int deadZone
Definition: joyaxis.h:176
JoyAxis::maxZoneValue
int maxZoneValue
Definition: joyaxis.h:177
HapticTriggerPs5::set_effect_mode
bool set_effect_mode(HapticTriggerModePs5 mode)
Changes the haptic feedback mode to the given type.
Definition: haptictriggerps5.cpp:250
GameControllerTrigger::hasHapticTrigger
virtual bool hasHapticTrigger() const override
Checks if the trigger supports haptic feedback.
Definition: gamecontrollertrigger.cpp:141
HAPTIC_TRIGGER_VIBRATION
@ HAPTIC_TRIGGER_VIBRATION
Definition: haptictriggermodeps5.h:28
HapticTriggerPs5
Represents a single haptic trigger effect on a PS5 controller. See https://gist.github....
Definition: haptictriggerps5.h:33
JoyAxis::hapticTriggerChanged
void hapticTriggerChanged()
JoyAxis::m_index
int m_index
Definition: joyaxis.h:181