1
0
mirror of https://github.com/cathery/sys-con.git synced 2024-11-16 23:11:25 +00:00
sys-con/source/ControllerLib/ControllerConfig.h

65 lines
1.2 KiB
C
Raw Normal View History

2019-11-06 22:20:58 +00:00
#pragma once
#include <cstdint>
#define MAX_JOYSTICKS 2
#define MAX_TRIGGERS 2
#define MAX_CONTROLLER_BUTTONS 32
enum ControllerButton : uint8_t
2019-11-06 22:20:58 +00:00
{
DEFAULT = 0,
NONE,
2019-11-06 22:20:58 +00:00
FACE_UP,
FACE_RIGHT,
FACE_DOWN,
FACE_LEFT,
LSTICK_CLICK,
RSTICK_CLICK,
LEFT_BUMPER,
RIGHT_BUMPER,
LEFT_TRIGGER,
RIGHT_TRIGGER,
BACK,
START,
DPAD_UP,
DPAD_RIGHT,
DPAD_DOWN,
DPAD_LEFT,
CAPTURE,
HOME,
2019-11-06 22:20:58 +00:00
SYNC,
2019-11-15 11:03:06 +00:00
TOUCHPAD,
2019-11-07 17:46:47 +00:00
};
struct NormalizedStick
{
float axis_x;
float axis_y;
2019-11-06 22:20:58 +00:00
};
2019-11-13 20:49:15 +00:00
union RGBAColor {
struct
{
uint8_t r;
uint8_t g;
uint8_t b;
uint8_t a;
};
uint8_t values[4];
uint32_t rgbaValue;
};
2019-11-06 22:20:58 +00:00
struct ControllerConfig
{
uint8_t stickDeadzonePercent[MAX_JOYSTICKS]{};
uint16_t stickRotationDegrees[MAX_JOYSTICKS]{};
uint8_t triggerDeadzonePercent[MAX_TRIGGERS]{};
ControllerButton buttons[MAX_CONTROLLER_BUTTONS]{};
float triggers[MAX_TRIGGERS]{};
NormalizedStick sticks[MAX_JOYSTICKS]{};
2019-11-13 20:49:15 +00:00
bool swapDPADandLSTICK{false};
RGBAColor bodyColor{107, 107, 107, 255};
RGBAColor buttonsColor{0, 0, 0, 255};
RGBAColor leftGripColor{70, 70, 70, 255};
RGBAColor rightGripColor{70, 70, 70, 255};
2019-11-06 22:20:58 +00:00
};