Install a simple Gamepad
System requirements
At first you have install your device-drivers. After you have checked, that the device is running for your system, run the jReality-class DeviceJinputController (de.jreality.toolsystem.raw.DeviceJinputController) which will show you the supported axis and buttons of the controller.
The gamepad which is used for this tutorial just has 4 buttons and 2 axis. The DeviceJinputController-class provides:
Linux plugin claims to have found 1 controllers Mega World USB 2-Axis 4-Button Gamepad :: [A, B, C, X, x, y]
Now we can create at de.jreality.toolsystem.config.chunks a xml-file for this gamepad, e.g. toolconfig-MegaWorldGamepad.xml . We use the following setup: You have to keep attention, to your controller settings and name!
<toolconfig> <rawdevices> <rawdevice id="Gamepad" type="de.jreality.toolsystem.raw.DeviceJinputController"> <prop name="id_string"> <string>Mega World USB 2-Axis 4-Button Gamepad</string> </prop> </rawdevice> </rawdevices> <rawslots> <mapping device="Gamepad" src="button_3" target="Button3" /> <mapping device="Gamepad" src="button_0" target="Button0" /> <mapping device="Gamepad" src="button_1" target="Button1" /> <mapping device="Gamepad" src="button_2" target="Button2" /> <mapping device="Gamepad" src="axis_4" target="RightLeftAxis" /> <mapping device="Gamepad" src="axis_5" target="ForwardBackwardAxis" /> </rawslots> <virtualdevices> <virtualdevice type="de.jreality.toolsystem.virtual.VirtualReverseAxis"> <inputslot>RightLeftAxis</inputslot> <outputslot>LeftRightAxis</outputslot> </virtualdevice> <virtualdevice type="de.jreality.toolsystem.virtual.VirtualMergedAxis"> <inputslot>Button0</inputslot> <inputslot>Button3</inputslot> <outputslot>HorizontalShipRotationAngleEvolution</outputslot> </virtualdevice> <virtualdevice type="de.jreality.toolsystem.virtual.VirtualMergedAxis"> <inputslot>Button2</inputslot> <inputslot>Button1</inputslot> <outputslot>VerticalHeadRotationAngleEvolution</outputslot> </virtualdevice> </virtualdevices> </toolconfig>
Now we have to include the new Controller to jReality. Open the toolconfig-split.xml file (de.jreality.toolsystem.config), toggle the mouse-import and add the following lines:
<!--import href="chunks/toolconfig-mouse-keyboard.xml" /--> <import href="chunks/toolconfig-MegaWorldGamepad.xml" /> <import href="chunks/toolconfig-no-mouse.xml" />
Save and run any tutorial to test the controller.