Contents

GCControllerElement

An input for a physical control, such as a button or thumbstick.

Declaration

class GCControllerElement

Overview

GCControllerElement is an abstract superclass for specific types of elements that represent controls on a game controller. Use the respective subclasses to either get the input of an element directly or set a handler that the element calls when the user changes a value. This class provides support for common features.

For complex elements that have subelements, you can get the containing element using the collection property. For example, a direction pad (GCControllerDirectionPad) has two axis control and four button subelements.

If the user binds a controller element to a system gesture, the system sends the input to the system gesture recognizer first. If it doesn’t recognize a gesture, the system sends the input to your app but with a delay. If it does recognize a gesture, it doesn’t send any input to your app.

To change this default behavior, you can set the preferredSystemGestureState property to GCControllerElement.SystemGestureState.alwaysReceive to receive the input simultaneously without delay. Alternatively, set it to GCControllerElement.SystemGestureState.disabled to disable the system gesture and receive the input exclusively. Use the isBoundToSystemGesture property to check whether the user included an element in a system gesture.

Use the isAnalog property to determine whether an element’s input value is a range of values or a discrete digital value.

Topics

Accessing input values

Getting a localized name

Displaying a symbol

Accessing elements by key

Getting the containing element

Handling system gesture input

See Also

Accessing controller elements