About Game Controllers

About Game Controllers

  Game Controller(GC),框架从iOS 7和OS X v10.9开始加入,用于便捷使用控制器(手柄). Once discovered, your game reads control inputs as part of its normal gameplay. There are three kinds of controllers available:

  • A standard form-fitting controller: An iOS device sits inside the controller and the player can access both the iOS device’s screen and the controller elements.
  • An extended form-fitting controller: An iOS device sits inside the controller and the player can access both the iOS device’s screen and the controller elements.
  • An extended wireless controller: A controller that wirelessly connects to an iOS device or Mac.

  在使用GC的时候,须把GC设为可选,即游戏没有手柄,也要能玩。GC的主要类是GCController,通过以下2方法来管理无线手柄的同步:

  

  When designing your game, you can use one of the following strategies to read the profile’s input elements:

  • In your game loop, poll the values of the elements you are interested in. Reading an input directly works best for elements that need to be read every frame, such as directional pads. (每帧读取
  • Register a block to be called when values change. You can choose to register a block for a single element or for all of the elements in the profile. Callbacks work best when you need to guarantee that a change is always detected. (设置回调读取
  • Periodically save a snapshot of the controller state. All of the controls are read simultaneously. Then, at a later point in the game, the controller data is processed.(保存完整profile数据,之后读取

 

原文地址:https://www.cnblogs.com/tekkaman/p/3666525.html