Skip to content

Instantly share code, notes, and snippets.

@WhiteMagic
Created February 20, 2017 07:24
Show Gist options
  • Save WhiteMagic/2164619026dbe412bed074e9a8129765 to your computer and use it in GitHub Desktop.
Save WhiteMagic/2164619026dbe412bed074e9a8129765 to your computer and use it in GitHub Desktop.
import gremlin
t16000 = gremlin.input_devices.JoystickDecorator(
"T.16000M",
72331530,
"Default"
)
g_last_axis_value = 0.0
increase = gremlin.input_devices.macro.Macro()
#increase.tap("=")
increase.tap(gremlin.input_devices.macro.Keys.KPPlus)
decrease = gremlin.input_devices.macro.Macro()
#decrease.tap("-")
decrease.tap(gremlin.input_devices.macro.Keys.KPMinus)
@t16000.axis(4)
def axis_motion(event):
global g_last_axis_value
cur_value = event.value
if cur_value > g_last_axis_value:
increase.run()
elif cur_value < g_last_axis_value:
decrease.run()
g_last_axis_value = cur_value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment