1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 23:52:26 +00:00

Inverts the Game Controller Framework value of the y axis.

This commit is contained in:
Thomas Harte 2021-04-28 20:31:35 -04:00
parent b6554c8255
commit ad10d0037a

View File

@ -368,7 +368,7 @@ API_AVAILABLE(macos(11.0))
return self; return self;
} }
-(void)update { - (void)update {
// Update buttons. // Update buttons.
for(CSGCJoystickButton *button in _buttons) { for(CSGCJoystickButton *button in _buttons) {
// This assumes that the values provided by GCDeviceButtonInput are // This assumes that the values provided by GCDeviceButtonInput are
@ -379,7 +379,11 @@ API_AVAILABLE(macos(11.0))
float val = axis.axis.value; float val = axis.axis.value;
val += 1; val += 1;
val /= 2; val /= 2;
axis.position = val; if(axis.type == CSJoystickAxisTypeY) {
axis.position = 1 - val;
} else {
axis.position = val;
}
} }
for(CSGCJoystickHat *hat in _hats) { for(CSGCJoystickHat *hat in _hats) {
// This assumes that the values provided by GCDeviceDirectionPad are // This assumes that the values provided by GCDeviceDirectionPad are