GCGamepad Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/GameController.framework
Availability
Available in iOS 7.0 and later.
Companion guide
Declared in
GCGamepad.h

Overview

A GCGamepad object implements a logical profile for a set of gamepad controls. A profile maps the hardware controls of a particular controller to a set of elements usable by your game.

The controls associated with the gamepad profile include the following:

../Art/featuresHIDGameControllerStandardFormFittingSample_2x.png

Tasks

Determining the Controller That Owns This Profile

Determining When Any Element in the Profile Changes

Reading Shoulder Button Inputs

Reading Directional Pad Inputs

Reading Face Button Inputs

Saving a Snapshot

Properties

buttonA

The bottom face button. (read-only)

@property(readonly) GCControllerButtonInput *buttonA
Discussion

The face buttons in the gamepad profile are analog buttons.

Availability
  • Available in iOS 7.0 and later.
Declared In
GCGamepad.h

buttonB

The right face button. (read-only)

@property(readonly) GCControllerButtonInput *buttonB
Discussion

The face buttons in the gamepad profile are analog buttons.

Availability
  • Available in iOS 7.0 and later.
Declared In
GCGamepad.h

buttonX

The left face button. (read-only)

@property(readonly) GCControllerButtonInput *buttonX
Discussion

The face buttons in the gamepad profile are analog buttons.

Availability
  • Available in iOS 7.0 and later.
Declared In
GCGamepad.h

buttonY

The top face button. (read-only)

@property(readonly) GCControllerButtonInput *buttonY
Discussion

The face buttons in the gamepad profile are analog buttons.

Availability
  • Available in iOS 7.0 and later.
Declared In
GCGamepad.h

controller

The controller this profile is associated with. (read-only)

@property(readonly, assign) GCController *controller
Availability
  • Available in iOS 7.0 and later.
Declared In
GCGamepad.h

dpad

The D-pad element. (read-only)

@property(readonly) GCControllerDirectionPad *dpad
Discussion

The directional pad in the gamepad profile is an analog control.

Availability
  • Available in iOS 7.0 and later.
Declared In
GCGamepad.h

leftShoulder

The left shoulder button element. (read-only)

@property(readonly) GCControllerButtonInput *leftShoulder
Discussion

The shoulder buttons in the gamepad profile are analog buttons.

Availability
  • Available in iOS 7.0 and later.
Declared In
GCGamepad.h

rightShoulder

The right shoulder button element. (read-only)

@property(readonly) GCControllerButtonInput *rightShoulder
Discussion

The shoulder buttons in the gamepad profile are analog buttons.

Availability
  • Available in iOS 7.0 and later.
Declared In
GCGamepad.h

valueChangedHandler

A block called when any element in the profile changes.

@property(copy) GCGamepadValueChangedHandler valueChangedHandler
Availability
  • Available in iOS 7.0 and later.
Declared In
GCGamepad.h

Instance Methods

saveSnapshot

Saves a snapshot of all of the profile’s elements.

- (GCGamepadSnapshot *)saveSnapshot
Return Value

A snapshot object that contains the current controller state.

Availability
  • Available in iOS 7.0 and later.
Declared In
GCGamepad.h

Constants

GCGamepadValueChangedHandler

Signature for the block executed if any element in the gamepad profile changes value.

typedef void (^GCGamepadValueChangedHandler)(GCGamepad *gamepad, GCControllerElement *element)
Discussion

The block parameters are defined as follows:

gamepad

The profile object whose value changed.

element

The element whose value changed.

If multiple elements change values at the same time, the block is called once for each element that changed. The block is called only for the elements directly attached to the profile object; if a child element of one of those elements changes values, the block is called for the parent.

This block type is used by the valueChangedHandler property.

Availability
  • Available in iOS 7.0 and later.
Declared In
GCGamepad.h