pub enum PadKind {
Xbox,
PlayStation,
PlayStation4,
Nintendo,
Playdate,
Generic,
}Expand description
Who made a pad, which decides the Confirm / Cancel swap here and the button names shown on screen (ticket 0220).
Variants§
Xbox
A Microsoft pad.
PlayStation
A Sony pad other than a PS4 one (a PS5 pad).
PlayStation4
A Sony PS4 pad: named as a PlayStation pad,
except its left centre button is Share.
Nintendo
A Nintendo pad (Switch Pro controller, Joy-Cons).
Playdate
The Playdate’s own buttons (game ADR-0070): the D-pad, A and B. Its
backend reports A at the binding position East and B at West
(targets/playdate.ron, ADR-0008 §1), with no swap, so a game binds
them in its keymap’s targets."playdate" table.
Generic
Anything else, or a pad that doesn’t say. Treated like an Xbox pad.
Implementations§
Source§impl PadKind
impl PadKind
Sourcepub fn from_ids(vendor: u16, product: u16) -> Self
pub fn from_ids(vendor: u16, product: u16) -> Self
The kind of a pad from its USB vendor and product ids; unknown
vendors (and 0, “not reported”) are Generic. The
product only matters for Sony, to tell a PS4 pad apart.
Sourcepub fn position(self, button: Button) -> Button
pub fn position(self, button: Button) -> Button
The position bindings use for the button physically at button on
this kind of pad: on a Nintendo pad the bottom and right face buttons
swap (so its right button, labelled A, is South and confirms by
default); every other button, and every other pad, is unchanged.
What help text calls the button at binding position button on
this kind of pad (docs/design/controls.md, Button names on
screen): Xbox letters (also on generic pads), Sony’s shapes,
or Nintendo’s letters (a PS4 pad says Share where later Sony pads
say Create). The Playdate’s A is East and its B is West, as
printed on it; every other name is the Xbox one, its D-pad’s and its
crank’s among them, but South’s, which is the X that leaves free:
A would name a button its A doesn’t press. It has none of the other
buttons (their actions move to chords and menus in tickets 1034 and
1035). The only place buttons get their names.
Sourcepub fn chord_name(self, chord: ButtonChord, join: &str) -> String
pub fn chord_name(self, chord: ButtonChord, join: &str) -> String
What help text calls chord on this kind of pad: its
button’s name, or a button chord’s two names
with join between them (A+B, B+← with +), in the chord’s
order.