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.

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

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

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

    import GameController

    becomes

    import GameController
    import VirtualGameController
  4. 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.

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

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

    VgcManager.startAs(.Central, appIdentifier: "")
  7. Use one of the "Peripheral" sample projects as your game controller!

    Note one limitation is that when using the Apple TV version, you must use the Remote to start the game because of issues related to how DemoBots implements this functionality (see the last paragraph on that page).