Skip to content

Testing using DemoBots

Rob Reuss edited this page Nov 6, 2015 · 11 revisions

Here are the steps for getting VirtualGameController up and running in DemoBots.

Download DemoBots: https://developer.apple.com/library/prerelease/ios/samplecode/DemoBots/Introduction/Intro.html

Perform a case-sensitive global search/replace from "GCController" to "VGCController", with these two exceptions: GCControllerDirectionPadValueChangedHandler GCControllerButtonValueChangedHandler

Add the following import statement each place where "import GameController" appears:

import GameController

becomes

import GameController
import VirtualGameController

For each platform you wish to try using DemoBots on (iOS, OS X, tvOS), add the platform-specific VirtualGameController framework file from the VirtualGameController framework projects to the DemoBots project, being careful when you add them to select the correct target (iOS, OS X or tvOS). You'll find the framework files within each Framework Project under Products - use "Show in Finder" to get to the file you need to add to DemoBots.

Make sure to add the framework to the Embedded Binaries section on the General tab for each target.

Add a framework import statement to GameViewController.swift for each platform:

import VirtualGameController

Add the following line to the viewDidLoad method of GameViewController.swift for each platform:

VgcManager.startAs(.Central, appIdentifier: "")

Use one of the "Peripheral" sample projects as your game controller!