Mercurial’s gamepads are a thin wrapper over Pasteurized
Gamepads. Go give the Pasteurized docs a look first.
The basic differences are:
- Mercurial gamepads have support for command bindings.
- Mercurial gamepads are obtained from Mercurial, rather than from Pasteurized.
BoundGamepad g1 = Mercurial.gamepad1();
Mercurial.gamepad2();
// remember, we can set the whole gamepad at once
Mercurial.gamepad2(Mercurial.gamepad1());
Mercurial’s BoundBooleanSupplier
and BoundDoubleSupplier
can both be built
from wrapping their Enhanced equivalents, or directly, see bindings for
examples.
You can combine buttons, sticks, triggers in the same ways as you can in
Pasteurized.
Additionally, the layering systems will work as well:
BoundGamepad teleopGamepad = new BoundGamepad(new SDKGamepad(gamepad1));
BoundGamepad endgameGamepad = new BoundGamepad(new SDKGamepad(gamepad1));
Map<Layers, BoundGamepad> mercurialGamepadMap = new HashMap<Layers, BoundGamepad>(){{
put(Layers.TELEOP, teleopGamepad);
put(Layers.ENDGAME, endgameGamepad);
}};
MapLayeringSystem<Layers, BoundDoubleSupplier, BoundBooleanSupplier, BoundGamepad> enumLayeringSystem = new MapLayeringSystem<>(Layers.TELEOP, pasteurizedGamepadMap);
// LayeredGamepad takes a LayeringSystem and makes a gamepad from it
LayeredGamepad<BoundDoubleSupplier, BoundBooleanSupplier, BoundGamepad> layeredGamepad = new LayeredGamepad<>(enumLayeringSystem);
// now, modify teleop and endgame gamepads,
// then bind commands to them individually
// don't bind commands to the layered gamepad,
// as this will not do what you expect
Overall, not too different from Pasteurized.