AntiMicroX
gamecontrollerset.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 GAMECONTROLLERSET_H
20 #define GAMECONTROLLERSET_H
21 
22 #include "setjoystick.h"
23 
24 #include <SDL2/SDL_gamecontroller.h>
25 
26 class QXmlStreamReader;
27 class InputDevice;
28 
33 {
34  Q_OBJECT
35 
36  public:
37  explicit GameControllerSet(InputDevice *device, int index, QObject *parent = nullptr);
38 
39  virtual void refreshAxes();
40 
41  virtual void readConfig(QXmlStreamReader *xml);
42 
43  protected:
44  void populateSticksDPad();
45 
46  public slots:
47  virtual void reset();
48  void applyHapticTrigger();
49 
50  private:
51  void getElemFromXml(QString elemName, QXmlStreamReader *xml);
52  void resetSticks();
53 };
54 
55 #endif // GAMECONTROLLERSET_H
SetJoystick::addControlStick
void addControlStick(int index, JoyControlStick *stick)
Definition: setjoystick.cpp:436
SetJoystick::getIndex
int getIndex() const
Definition: setjoystick.cpp:507
readConf
void readConf(T *x, QXmlStreamReader *xml)
Definition: gamecontrollerset.cpp:112
gamecontroller.h
joycontrolstick.h
SetJoystick::getSensor
JoySensor * getSensor(JoySensorType type) const
Definition: setjoystick.cpp:71
JoyAxis
Represents single axis of of joystick (or other input)
Definition: joyaxis.h:40
JoyAxis::getHapticTrigger
virtual HapticTriggerPs5 * getHapticTrigger() const
Always returns nullptr for JoyAxis base objects.
Definition: joyaxis.cpp:307
JoyButton::setDefaultButtonName
virtual void setDefaultButtonName(QString tempname)
Definition: joybutton.cpp:3616
GameControllerSet::applyHapticTrigger
void applyHapticTrigger()
Applies haptic feedback to the triggers of the controller.
Definition: gamecontrollerset.cpp:50
GameControllerSet::resetSticks
void resetSticks()
Definition: gamecontrollerset.cpp:62
GameControllerSet::getElemFromXml
void getElemFromXml(QString elemName, QXmlStreamReader *xml)
Definition: gamecontrollerset.cpp:165
joysensor.h
joybuttonxml.h
joyaxisxml.h
GameControllerDPad
Definition: gamecontrollerdpad.h:31
InputDevice
Abstract class representing a hardware input device, e.g a joystick or controller.
Definition: inputdevice.h:50
SetJoystick::getVDPad
VDPad * getVDPad(int index) const
Definition: setjoystick.cpp:67
GameControllerSet::populateSticksDPad
void populateSticksDPad()
Definition: gamecontrollerset.cpp:68
gamecontrollertrigger.h
JoyDPadXml
Definition: joydpadxml.h:26
SetJoystick
A set of mapped events which can by switched by a controller event. Contains controller input objects...
Definition: setjoystick.h:39
SetJoystick::deleteAxes
void deleteAxes()
Definition: setjoystick.cpp:155
joydpadxml.h
SetJoystick::reset
virtual void reset()
Re-enumerates inputs from the associated device and resets all mappings in this set.
Definition: setjoystick.cpp:261
JoyAxisXml
Definition: joyaxisxml.h:29
JoyDPad::setDefaultDPadName
virtual void setDefaultDPadName(QString tempname)
Definition: joydpad.cpp:537
InputDevice::getNumberRawAxes
virtual int getNumberRawAxes()=0
GameControllerSet::reset
virtual void reset()
Definition: gamecontrollerset.cpp:42
HapticTriggerPs5::send
static void send(SDL_GameController *controller, const HapticTriggerPs5 &left, const HapticTriggerPs5 &right)
Creates an low level message from two HapticTriggerPs5 objects and send them to the controller.
Definition: haptictriggerps5.cpp:287
SetJoystick::getJoyStick
JoyControlStick * getJoyStick(int index) const
Definition: setjoystick.cpp:69
SetJoystick::enableAxisConnections
void enableAxisConnections(JoyAxis *axis)
Definition: setjoystick.cpp:867
JoySensorType
JoySensorType
Definition: joysensortype.h:23
SetJoystickXml::joyButtonXml
JoyButtonXml * joyButtonXml
Definition: setjoystickxml.h:49
haptictriggerps5.h
GameControllerTrigger
Definition: gamecontrollertrigger.h:29
JoyAxis::setDefaultAxisName
virtual void setDefaultAxisName(QString tempname)
Definition: joyaxis.cpp:736
gamecontrollerset.h
GameControllerSet::GameControllerSet
GameControllerSet(InputDevice *device, int index, QObject *parent=nullptr)
Definition: gamecontrollerset.cpp:35
SetJoystick::getJoyButton
JoyButton * getJoyButton(int index) const
Definition: setjoystick.cpp:57
inputdevice.h
GameControllerSet::readConfig
virtual void readConfig(QXmlStreamReader *xml)
Deserializes the given XML stream into a SetJoystick object.
Definition: gamecontrollerset.cpp:123
SetJoystick::addVDPad
void addVDPad(int index, VDPad *vdpad)
Definition: setjoystick.cpp:473
JoyControlStick
Represents stick of a joystick.
Definition: joycontrolstick.h:37
JoyButton
Represents a single joystick button being part of a SetJoystick Contains multiple JoyButtonSlots whic...
Definition: joybutton.h:46
GameController::getController
SDL_GameController * getController() const
Definition: gamecontroller.cpp:383
GameController
Represents a typical gamepad (like PS4 or Xbox gamepad)
Definition: gamecontroller.h:44
SetJoystick::getInputDevice
InputDevice * getInputDevice() const
Definition: setjoystick.cpp:931
SetJoystick::getJoyAxis
JoyAxis * getJoyAxis(int index) const
Definition: setjoystick.cpp:59
JoySensor
Represents one sensor in a SetJoystick and its connections to other parts of the application....
Definition: joysensor.h:39
setjoystick.h
GameControllerSet::refreshAxes
virtual void refreshAxes()
Definition: gamecontrollerset.cpp:233
SetJoystick::getAxes
QHash< int, JoyAxis * > * getAxes()
Definition: setjoystick.cpp:1101
JoyControlStick::setDefaultStickName
virtual void setDefaultStickName(QString tempname)
Definition: joycontrolstick.cpp:824
JoyButtonXml
Definition: joybuttonxml.h:27
gamecontrollerdpad.h
GameControllerSet
A SetJoystick specialized for gamepads.
Definition: gamecontrollerset.h:32
HapticTriggerPs5
Represents a single haptic trigger effect on a PS5 controller. See https://gist.github....
Definition: haptictriggerps5.h:33
JoyAxis::hapticTriggerChanged
void hapticTriggerChanged()
SetJoystick::setName
void setName(QString name)
Definition: setjoystick.cpp:933