Updates EmulationViewController Game Controller methods & matches DeltaCore refactoring
This commit is contained in:
parent
07da4f3158
commit
0f43de2138
@ -1 +1 @@
|
||||
Subproject commit d8532bd184a9a1e87b48ad5ad9f4a6d24d81783f
|
||||
Subproject commit 1476246c71526677acf299907ec5ec4fbc3f6d89
|
||||
@ -1 +1 @@
|
||||
Subproject commit 58dce561dd80baf954f487fc8fa15aae998559a6
|
||||
Subproject commit 99aeaa0ce70be0d943c49a124f8781d08cacf634
|
||||
@ -103,8 +103,6 @@ class EmulationViewController: UIViewController
|
||||
|
||||
self.controllerView.containerView = self.view
|
||||
self.controllerView.controllerSkin = controllerSkin
|
||||
self.controllerView.addReceiver(self)
|
||||
self.emulatorCore.setGameController(self.controllerView, atIndex: 0)
|
||||
|
||||
self.updateControllers()
|
||||
}
|
||||
@ -290,14 +288,25 @@ private extension EmulationViewController
|
||||
|
||||
if let index = Settings.localControllerPlayerIndex
|
||||
{
|
||||
self.emulatorCore.setGameController(self.controllerView, atIndex: index)
|
||||
self.controllerView.playerIndex = index
|
||||
}
|
||||
|
||||
for controller in ExternalControllerManager.sharedManager.connectedControllers
|
||||
var controllers = [GameControllerProtocol]()
|
||||
controllers.append(self.controllerView)
|
||||
|
||||
// We need to map each item as a GameControllerProtocol due to a Swift bug
|
||||
controllers.appendContentsOf(ExternalControllerManager.sharedManager.connectedControllers.map { $0 as GameControllerProtocol })
|
||||
|
||||
for controller in controllers
|
||||
{
|
||||
if let index = controller.playerIndex
|
||||
{
|
||||
self.emulatorCore.setGameController(controller, atIndex: index)
|
||||
controller.addReceiver(self)
|
||||
}
|
||||
else
|
||||
{
|
||||
controller.removeReceiver(self)
|
||||
}
|
||||
}
|
||||
|
||||
@ -318,7 +327,7 @@ private extension EmulationViewController
|
||||
}
|
||||
}
|
||||
|
||||
func sustainInput(input: InputType, gameController: GameControllerType)
|
||||
func sustainInput(input: InputType, gameController: GameControllerProtocol)
|
||||
{
|
||||
if let input = input as? ControllerInput
|
||||
{
|
||||
@ -485,11 +494,11 @@ private extension EmulationViewController
|
||||
|
||||
//MARK: - <GameControllerReceiver> -
|
||||
/// <GameControllerReceiver>
|
||||
extension EmulationViewController: GameControllerReceiverType
|
||||
extension EmulationViewController: GameControllerReceiverProtocol
|
||||
{
|
||||
func gameController(gameController: GameControllerType, didActivateInput input: InputType)
|
||||
func gameController(gameController: GameControllerProtocol, didActivateInput input: InputType)
|
||||
{
|
||||
if UIDevice.currentDevice().supportsVibration
|
||||
if gameController is ControllerView && UIDevice.currentDevice().supportsVibration
|
||||
{
|
||||
UIDevice.currentDevice().vibrate()
|
||||
}
|
||||
@ -510,7 +519,7 @@ extension EmulationViewController: GameControllerReceiverType
|
||||
}
|
||||
}
|
||||
|
||||
func gameController(gameController: GameControllerType, didDeactivateInput input: InputType)
|
||||
func gameController(gameController: GameControllerProtocol, didDeactivateInput input: InputType)
|
||||
{
|
||||
guard let input = input as? ControllerInput else { return }
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user