Created
March 3, 2018 23:35
-
-
Save WhiteMagic/d18368eaf370cda17dd0392c5935329e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import gremlin | |
# Use and configure this if different joystick types are being used | |
device1 = gremlin.input_devices.JoystickDecorator( | |
"T.16000M", | |
72331530, | |
"Default" | |
) | |
device2 = gremlin.input_devices.JoystickDecorator( | |
"Joystick - HOTAS Warthog", | |
72287234, | |
"Default" | |
) | |
# Use and configure this if two identical joysticks are used | |
#device1 = gremlin.input_devices.JoystickDecorator( | |
# "T.16000M", | |
# (72331530, 1), | |
# "Default" | |
#) | |
#device2 = gremlin.input_devices.JoystickDecorator( | |
# "T.16000M", | |
# (72331530, 2), | |
# "Default" | |
#) | |
# Configure these values | |
g_device1_axis = 3 | |
g_device2_axis = 2 | |
g_vjoy_axis = 3 | |
# Should not need to change anything below this line | |
g_device1_value = 0.0 | |
g_device2_value = 0.0 | |
@device1.axis(g_device1_axis) | |
def dev1_axis(event, vjoy): | |
global g_device1_value | |
g_device1_value = event.value | |
vjoy[1].axis(g_vjoy_axis).value = min(1.0, max(-1.0, g_device1_value + g_device2_value)) | |
@device2.axis(g_device2_axis) | |
def dev2_axis(event, vjoy): | |
global g_device2_value | |
g_device2_value = event.value | |
vjoy[1].axis(g_vjoy_axis).value = min(1.0, max(-1.0, g_device1_value + g_device2_value)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment