iOS Developer Library

Developer

GameController Framework Reference GCControllerDirectionPad Class Reference

Options
Deployment Target:

On This Page
Language:

GCControllerDirectionPad

Inherits From


Conforms To


Import Statement


Swift

import GameController

Objective-C

@import GameController;

Availability


Available in iOS 7.0 and later

A GCControllerDirectionPad object represents a two-dimensional control such as a directional pad or a thumbstick. This element does not provide values of its own. Instead, its values are provided by its child elements. It provides two sets of children that map to the same physical controls, so your app can view the directional pad as either either a pair of axis elements (horizontal, vertical), or four button elements (up, down, left, right).

  • xAxis xAxis Property

    The value of the directional pad along the horizontal axis (left and right). (read-only)

    Declaration

    Swift

    var xAxis: GCControllerAxisInput! { get }

    Objective-C

    @property(readonly) GCControllerAxisInput *xAxis

    Import Statement

    Objective-C

    @import GameController;

    Swift

    import GameController

    Availability

    Available in iOS 7.0 and later

  • yAxis yAxis Property

    The value of the directional pad along the vertical axis (up and down). (read-only)

    Declaration

    Swift

    var yAxis: GCControllerAxisInput! { get }

    Objective-C

    @property(readonly) GCControllerAxisInput *yAxis

    Import Statement

    Objective-C

    @import GameController;

    Swift

    import GameController

    Availability

    Available in iOS 7.0 and later

  • up up Property

    A measurement of how far up the directional pad has been moved. (read-only)

    Declaration

    Swift

    var up: GCControllerButtonInput! { get }

    Objective-C

    @property(readonly) GCControllerButtonInput *up

    Discussion

    The value of the up property is mutually exclusive with the value of the down property. This means that whenever the value of the up property is non-zero, the value of the down property is 0.

    Import Statement

    Objective-C

    @import GameController;

    Swift

    import GameController

    Availability

    Available in iOS 7.0 and later

  • down down Property

    A measurement of how far down the directional pad has been moved. (read-only)

    Declaration

    Swift

    var down: GCControllerButtonInput! { get }

    Objective-C

    @property(readonly) GCControllerButtonInput *down

    Discussion

    The value of the down property is mutually exclusive with the value of the up property. This means that whenever the value of the down property is non-zero, the value of the up property is 0.

    Import Statement

    Objective-C

    @import GameController;

    Swift

    import GameController

    Availability

    Available in iOS 7.0 and later

  • left left Property

    A measurement of how far left the directional pad has been moved. (read-only)

    Declaration

    Swift

    var left: GCControllerButtonInput! { get }

    Objective-C

    @property(readonly) GCControllerButtonInput *left

    Discussion

    The value of the left property is mutually exclusive with the value of the right property. This means that whenever the value of the left property is non-zero, the value of the right property is 0.

    Import Statement

    Objective-C

    @import GameController;

    Swift

    import GameController

    Availability

    Available in iOS 7.0 and later

  • right right Property

    A measurement of how far right the directional pad has been moved. (read-only)

    Declaration

    Swift

    var right: GCControllerButtonInput! { get }

    Objective-C

    @property(readonly) GCControllerButtonInput *right

    Discussion

    The value of the right property is mutually exclusive with the value of the left property. This means that whenever the value of the right property is non-zero, the value of the left property is 0.

    Import Statement

    Objective-C

    @import GameController;

    Swift

    import GameController

    Availability

    Available in iOS 7.0 and later

  • A handler to be called when the directional pad element changes values.

    Declaration

    Swift

    var valueChangedHandler: GCControllerDirectionPadValueChangedHandler!

    Objective-C

    @property(copy) GCControllerDirectionPadValueChangedHandler valueChangedHandler

    Import Statement

    Objective-C

    @import GameController;

    Swift

    import GameController

    Availability

    Available in iOS 7.0 and later

Data Types

  • Signature for the block executed when either axis changes values.

    Declaration

    Swift

    typealias GCControllerDirectionPadValueChangedHandler = (GCControllerDirectionPad!, Float, Float) -> Void

    Objective-C

    typedef void (^GCControllerDirectionPadValueChangedHandler)(GCControllerDirectionPad *dpad, float xValue, float yValue)

    Discussion

    The block parameters are defined as follows:

    dpad

    The axis element whose value changed.

    xValue

    The new value of the x-axis, measured from -1 to 1.

    yValue

    The new value of the y-axis, measured from -1 to 1.

    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