Example #1
0
import gremlin
import time
from gremlin.spline import CubicSpline
from vjoy.vjoy import AxisName
from configuration import * # load constants defining the devices connected to this PC

# input stick
t16k = gremlin.input_devices.JoystickDecorator( T16K_NAME, gremlin.common.DeviceIdentifier(T16K_HWID,T16K_ID) , MODE_ALL )
tms = gremlin.input_devices.JoystickDecorator( TM_STICK_NAME, gremlin.common.DeviceIdentifier(TM_STICK__HWID,TM_STICK__ID) , MODE_ALL )

curve = CubicSpline([
	(-1.0, -1.0),
	(-0.5, -0.25),
	( 0.0,  0.0),
	( 0.5,  0.25),
	( 1.0,  1.0)
])

gremlin.util.log("Custom scale module enabled")

y_invert = -1.0
active_scale = 1.0
min_scale = 0.15
toggle_nose_wheel = False

@tms.button(4)
def toggle_nsw(event, vjoy):
	global toggle_nose_wheel
	toggle_nose_wheel = not(toggle_nose_wheel)
	
@tms.axis(1):	
Example #2
0
# check device information in Gremlin for your (harware id, system id)
t16000m = gremlin.input_devices.JoystickDecorator(
    name="T.16000M",
    device_id=(72331530,1)
    mode="Default"
)

# set correct axis for joysticks and vjoy output
inputY          = 2      # joystick axis "Axis 2"
inputSlider     = 4      # joystick axis "Axis 4"
slider          = 7      # vjoy axis "7ax"

# set your curve values (curve values can be read from profile xml)
curve = CubicSpline([
    (-1.0, -1.0),
    ( 1.0, 1.0),
    ( 0.0, 0.0),
    ( 0.1, 0.05),
])
inversionY      = -1     # -1 if Y axis is inverted, else 1
inversionSlider = -1     # -1 if Y axis is inverted, else 1
sliderValue     = -1     # intial value of slider is all the way down

@t16000m.axis(inputY)
def setSliderValue(event, vjoy):
    # reading input of y (so need to adjust with curve)
    y = curve(event.value * inversionY)
    vjoy[1].axis(slider).value = sliderValue + (y*2)

@t16000m.axis(inputSlider)
def getSliderValue(event, vjoy):
    global sliderValue
Example #3
0
from vjoy.vjoy import AxisName

# Create joystick decorator for the CH Fighterstick in global mode
chfs = gremlin.input_devices.JoystickDecorator("CH Fighterstick USB",
                                               2382820288, "Global")
chfs_roll = gremlin.input_devices.JoystickDecorator("CH Fighterstick USB",
                                                    2382820288, "roll")
chpp = gremlin.input_devices.JoystickDecorator("CH Pro Pedals USB", 2382820032,
                                               "Global")

# Sensitivity curve setup
default_curve = CubicSpline([
    (-1.00, -1.00),
    (-0.75, -0.65),
    (-0.25, -0.15),
    (0.00, 0.00),
    (0.25, 0.15),
    (0.75, 0.65),
    (1.00, 1.00),
])
sniper_curve = CubicSpline([(-1.00, -0.50), (-0.50, -0.175), (0.00, 0.00),
                            (0.50, 0.175), (1.00, 0.50)])

left_pedal = 0
right_pedal = 0
is_firing = False

# Build macros so we don't construct them each time the callback is run
shield_macros = {
    "reset": macro.Macro(),
    "front": macro.Macro(),