Skip to content

Joystick Button Groups #7992

Open
Open
@ArchdukeTim

Description

@ArchdukeTim

A common pattern is to combine multiple joystick buttons to perform certain actions, while the individual buttons perform individual actions. For example, the 'a' and 'b' buttons could be used to perform 3 actions: one when just a is pressed, one when just b is pressed, and one when both are pressed.

Currently, the way to set this up is

a().and(b().negate())...
b().and(a().negate())...
a().and(b())...

This is a bit cumbersome. Also, the .negate() triggers are not cached the way the positive versions of the triggers are, so it can lead to duplicate trigger definitions depending on the size of the group

It would be nicer if there was syntax to allow

a()...
b()...
a().and(b())...

or some variation.

For example, assuming there was some class ButtonGroup that handled the logic:

ButtonGroup intakeActions;

intakeActions.only(a())
intakeActions.only(b())
intakeActions.all()...

perhaps a generic version (though I don't think generics would let there be different methods like this, at least not in java)

ButtonGroup<A, B> intakeActions;
intakeActions.a()...
intakeActions.b()...
intakeActions.both()...

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: featureBrand new functionality, features, pages, workflows, endpoints, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions