added four more axis to joystick handlers (fixes #1063)

This commit is contained in:
thrust26 2025-01-17 20:10:42 +01:00
parent 66823c533a
commit 01c8a87e19
3 changed files with 13 additions and 5 deletions

View File

@ -129,10 +129,10 @@ class JoyMap
size_t operator()(const JoyMapping& m)const {
return std::hash<uInt64>()((static_cast<uInt64>(m.mode)) // 3 bits
+ ((static_cast<uInt64>(m.button)) * 7) // 3 bits
+ (((static_cast<uInt64>(m.axis)) << 0) // 2 bits
| ((static_cast<uInt64>(m.adir)) << 2) // 2 bits
| ((static_cast<uInt64>(m.hat )) << 4) // 1 bit
| ((static_cast<uInt64>(m.hdir)) << 5) // 2 bits
+ (((static_cast<uInt64>(m.axis)) << 0) // 3 bits
| ((static_cast<uInt64>(m.adir)) << 3) // 2 bits
| ((static_cast<uInt64>(m.hat )) << 5) // 1 bit
| ((static_cast<uInt64>(m.hdir)) << 6) // 2 bits
) * 61
);
}

View File

@ -31,7 +31,11 @@ NLOHMANN_JSON_SERIALIZE_ENUM(JoyAxis, {
{JoyAxis::X, "x"},
{JoyAxis::Y, "y"},
{JoyAxis::Z, "z"},
{JoyAxis::A3, "a3"}
{JoyAxis::A3, "a3"},
{JoyAxis::A4, "a4"},
{JoyAxis::A5, "a5"},
{JoyAxis::A6, "a6"},
{JoyAxis::A7, "a7"}
})
NLOHMANN_JSON_SERIALIZE_ENUM(JoyDir, {

View File

@ -52,6 +52,10 @@ enum class JoyAxis: Int8 {
Y = 1, // since they'll be used as array indices
Z = 2,
A3 = 3,
A4 = 4,
A5 = 5,
A6 = 6,
A7 = 7,
NONE = JOY_CTRL_NONE
};