mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-25 20:36:54 +01:00
3ff6606fcb
* Revamp input mapping dialog with tabs, gamepad remapping and gyro emulation toggle Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Add emulated touchpad (mouse/gamepad) with particle skins; widen input dialog Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Disable mouse touchpad mode when the cursor leaves the window Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Add touchpad hand-cursor toggle; share touchpad options across both tabs Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Hide touchpad trail and particles when the visual toggle is off Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Rename input mapping tabs Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Rumble non-DualSense gamepads from haptic audio Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Fix input mapping, touchpad transitions, and rumble fallback --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Co-authored-by: nmzik <Nmzik@mail.ru>
56 lines
1.7 KiB
C++
56 lines
1.7 KiB
C++
#ifndef CONTROLLER_PREVIEW_H
|
|
#define CONTROLLER_PREVIEW_H
|
|
|
|
#include <QColor>
|
|
#include <QMap>
|
|
#include <QObject>
|
|
#include <QPointF>
|
|
#include <QSet>
|
|
#include <QString>
|
|
#include <QTimer>
|
|
|
|
#include <SDL3/SDL_gamepad.h>
|
|
|
|
class ControllerPreview final: public QObject {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit ControllerPreview(QObject* parent = nullptr);
|
|
~ControllerPreview() override;
|
|
|
|
void SetColor(const QString& color);
|
|
void SetPreviewEnabled(bool enabled);
|
|
void Stop();
|
|
void SetSuspended(bool suspended);
|
|
|
|
[[nodiscard]] const QSet<QString>& Pressed() const { return m_pressed; }
|
|
[[nodiscard]] const QSet<QString>& RawPressed() const { return m_raw_pressed; }
|
|
[[nodiscard]] QPointF LeftStick() const { return m_left_stick; }
|
|
[[nodiscard]] QPointF RightStick() const { return m_right_stick; }
|
|
[[nodiscard]] const QString& DeviceName() const { return m_device_name; }
|
|
[[nodiscard]] const QString& Error() const { return m_error; }
|
|
|
|
signals:
|
|
void StateChanged();
|
|
|
|
private:
|
|
void UpdateRunning();
|
|
void OpenGamepad(SDL_JoystickID id);
|
|
void Refresh();
|
|
void ApplyColor(SDL_Gamepad* gamepad) const;
|
|
|
|
QTimer m_timer;
|
|
QMap<SDL_JoystickID, SDL_Gamepad*> m_gamepads;
|
|
QColor m_color;
|
|
bool m_preview_enabled = false;
|
|
bool m_suspended = false;
|
|
QSet<QString> m_pressed;
|
|
QSet<QString> m_raw_pressed;
|
|
QPointF m_left_stick;
|
|
QPointF m_right_stick;
|
|
QString m_device_name;
|
|
QString m_error;
|
|
};
|
|
|
|
#endif // CONTROLLER_PREVIEW_H
|