Arcade stick

This page describes the basics of programming for Xbox One arcade sticks using Windows.Gaming.Input.ArcadeStick and related APIs for the Universal Windows Platform (UWP).

By reading this page, you'll learn:

  • how to gather a list of connected arcade sticks and their users
  • how to detect that an arcade stick has been added or removed
  • how to read input from one or more arcade sticks
  • how arcade sticks behave as UI navigation devices

Arcade stick overview

Arcade sticks are input devices valued for reproducing the feel of stand-up arcade machines and for their high-precision digital controls. Arcade sticks are the perfect input device for head-to-head-fighting and other arcade-style games, and are suitable for any game that works well with all-digital controls. Arcade sticks are supported in Windows 10 and Xbox One UWP apps by the Windows.Gaming.Input namespace.

Xbox One arcade sticks are equipped with an 8-way digital joystick, six Action buttons (represented as A1-A6 in the image below), and two Special buttons (represented as S1 and S2); they're all-digital input devices that don't support analog controls or vibration. Xbox One arcade sticks are also equipped with View and Menu buttons used to support UI navigation but they're not intended to support gameplay commands and can't be readily accessed as joystick buttons.

Arcade stick with 4-directional joystick, 6 action buttons (A1-A6), and 2 special buttons (S1 and S2)

UI navigation

In order to ease the burden of supporting many different input devices for user interface navigation and to encourage consistency between games and devices, most physical input devices simultaneously act as a separate logical input device called a UI navigation controller. The UI navigation controller provides a common vocabulary for UI navigation commands across input devices.

As a UI navigation controller, arcade sticks map the required set of navigation commands to the joystick and View, Menu, Action 1, and Action 2 buttons.

Navigation command Arcade stick input
Up Stick up
Down Stick down
Left Stick left
Right Stick right
View View button
Menu Menu button
Accept Action 1 button
Cancel Action 2 button

Arcade sticks don't map any of the optional set of navigation commands.

Detect and track arcade sticks

Detecting and tracking arcade sticks works in exactly the same way as it does for gamepads, except with the ArcadeStick class instead of the Gamepad class. See Gamepad and vibration for more information.

Reading the arcade stick

After you identify the arcade stick that you're interested in, you're ready to gather input from it. However, unlike some other kinds of input that you might be used to, arcade sticks don't communicate state-change by raising events. Instead, you take regular readings of their current state by polling them.

Polling the arcade stick

Polling captures a snapshot of the arcade stick at a precise point in time. This approach to input gathering is a good fit for most games because their logic typically runs in a deterministic loop rather than being event-driven; it's also typically simpler to interpret game commands from input gathered all at once than it is from many single inputs gathered over time.

You poll an arcade stick by calling GetCurrentReading; this function returns an ArcadeStickReading that contains the state of the arcade stick.

The following example polls an arcade stick for its current state.

auto arcadestick = myArcadeSticks[0];

ArcadeStickReading reading = arcadestick->GetCurrentReading();

In addition to the arcade stick state, each reading includes a timestamp that indicates precisely when the state was retrieved. The timestamp is useful for relating to the timing of previous readings or to the timing of the game simulation.

Reading the buttons

Each of the arcade stick buttons—the four directions of the joystick, six Action buttons, and two Special buttons—provides a digital reading that indicates whether it's pressed (down) or released (up). For efficiency, button readings aren't represented as individual boolean values; instead, they're all packed into a single bitfield that's represented by the ArcadeStickButtons enumeration.

Note

Arcade sticks are equipped with additional buttons used for UI navigation such as the View and Menu buttons. These buttons are not a part of the ArcadeStickButtons enumeration and can only be read by accessing the arcade stick as a UI navigation device. For more information, see UI Navigation Device.

The button values are read from the Buttons property of the ArcadeStickReading structure. Because this property is a bitfield, bitwise masking is used to isolate the value of the button that you're interested in. The button is pressed (down) when the corresponding bit is set; otherwise, it's released (up).

The following example determines whether the Action 1 button is pressed.

if (ArcadeStickButtons::Action1 == (reading.Buttons & ArcadeStickButtons::Action1))
{
    // Action 1 is pressed
}

The following example determines whether the Action 1 button is released.

if (ArcadeStickButtons::None == (reading.Buttons & ArcadeStickButtons::Action1))
{
    // Action 1 is released (not pressed)
}

Sometimes you might want to determine when a button transitions from pressed to released or released to pressed, whether multiple buttons are pressed or released, or if a set of buttons are arranged in a particular way—some pressed, some not. For information on how to detect these conditions, see Detecting button transitions and Detecting complex button arrangements.

Run the InputInterfacing sample

The InputInterfacingUWP sample (github) demonstrates how to use arcade sticks and different kinds of input devices in tandem, as well as how these input devices behave as UI navigation controllers.

See also