iOS Developer Library — Prerelease

Developer

Game Controller Framework Reference GCControllerAxisInput Class Reference

Options
Deployment Target:

On This Page
Language:

GCControllerAxisInput

A GCControllerAxisInput element measures movement along a particular axis. An axis element is always an analog element.

  • The current value of the axis. (read-only)

    Declaration

    Swift

    var value: Float { get }

    Objective-C

    @property(nonatomic, readonly) float value

    Discussion

    On a physical controller, it is common for a portion of the physical control’s moment to be ignored near its neutral position. This part of the control is known as its deadzone. The GCControllerAxisInput element handles the deadzone and other physical constraints of the hardware control and computes a normalized value. The value is in a range from -1 to 1. If the value is 0, then the movement is in the deadzone. A non-zero value indicates the moment is outside of the deadzone. The value is normalized so that no values are lost because of the deadzone.

    Availability

    Available in iOS 7.0 and later.

Data Types

  • The signature for the block executed when an axis changes values.

    Declaration

    Swift

    typealias GCControllerAxisValueChangedHandler = (GCControllerAxisInput, Float) -> Void

    Objective-C

    typedef void (^GCControllerAxisValueChangedHandler)(GCControllerAxisInput *axis, float value)

    Discussion

    The block parameters are defined as follows:

    axis

    The axis element whose value changed.

    value

    The new value.

    This block type is used by the valueChangedHandler property.

    Import Statement

    Objective-C

    @import GameController;

    Swift

    import GameController

    Availability

    Available in iOS 7.0 and later.