Contents

GCVirtualController

A software emulation of a real controller that you configure specifically for your game.

Declaration

class GCVirtualController

Mentioned in

Overview

Use a virtual controller to display software controls that you can customize over your game. You create a virtual controller from a configuration where you choose the input elements to display. You can even customize the images for the elements. When you connect the controller to the device, users interact with it similarly to a real controller.

[Image]

To add a virtual controller to your game, create a GCVirtualController.Configuration object containing the elements you want to appear in the controller. Then create the virtual controller by passing the configuration to the init(configuration:) method. Use the connect(replyHandler:) method to display the virtual controller on the screen.

To customize an element in the virtual controller, pass a new GCVirtualController.ElementConfiguration object for the element to the updateConfiguration(forElement:configuration:) method.

You process input from a virtual controller similarly to a real controller. Use the controller property to get the underlying GCController object. You can either poll the elements of the controller object or set the element’s handlers to get callbacks when their input values change.

Topics

Creating virtual controllers

Customizing the elements

Accessing the elements

Connecting and displaying virtual controllers

Presenting a custom interface

See Also

Virtual controller