VirtualController

The virtual controller is based on the SNES. If you need more detail, try using the joystick or keyboard and mouse members directly.

 l          r

 U          X
L R  s  S  Y A
 D          B

For Playstation and XBox controllers plugged into the computer, it picks those buttons based on similar layout on the physical device.

For keyboard control, arrows and WASD are mapped to the d-pad (ULRD in the diagram), Q and E are mapped to the shoulder buttons (l and r in the diagram).So are U and P.

Z, X, C, V (for when right hand is on arrows) and K,L,I,O (for left hand on WASD) are mapped to B,A,Y,X buttons.

G is mapped to select (s), and H is mapped to start (S).

The space bar and enter keys are also set to button A, with shift mapped to button B.

Additionally, the mouse is mapped to the virtual joystick, and mouse buttons left and right are mapped to shoulder buttons L and R.

More...
struct VirtualController {
ushort previousState;
ushort state;
ushort truePreviousState;
ushort lastStateChange;
bool repeating;
@nogc pure nothrow @safe
VirtualJoystick stick;
}

Members

Enums

Button
enum Button

Functions

justPressed
bool justPressed(Button idx)
justReleased
bool justReleased(Button idx)
opIndex
bool opIndex(Button idx)

Detailed Description

Only player 1 is mapped to the keyboard.

Meta