mirror of https://github.com/axmolengine/axmol.git
Support for the tvOS micro gamepad as a CCController (#17517)
* Fixes cocos2d build for tvOS. * Support for the tvOS micro gamepad as a CCController.
This commit is contained in:
parent
f0061c3ddc
commit
e3bff6452d
|
@ -254,7 +254,7 @@ void Controller::registerListeners()
|
|||
}
|
||||
};
|
||||
}
|
||||
else
|
||||
else if (_impl->_gcController.gamepad != nil)
|
||||
{
|
||||
_impl->_gcController.gamepad.dpad.up.valueChangedHandler = ^(GCControllerButtonInput *button, float value, BOOL pressed){
|
||||
onButtonEvent(Key::BUTTON_DPAD_UP, pressed, value, button.isAnalog);
|
||||
|
@ -300,6 +300,38 @@ void Controller::registerListeners()
|
|||
}
|
||||
};
|
||||
}
|
||||
#if defined(CC_TARGET_OS_TVOS)
|
||||
else if (_impl->_gcController.microGamepad != nil)
|
||||
{
|
||||
_impl->_gcController.microGamepad.dpad.up.valueChangedHandler = ^(GCControllerButtonInput *button, float value, BOOL pressed){
|
||||
onButtonEvent(Key::BUTTON_DPAD_UP, pressed, value, button.isAnalog);
|
||||
};
|
||||
|
||||
_impl->_gcController.microGamepad.dpad.down.valueChangedHandler = ^(GCControllerButtonInput *button, float value, BOOL pressed){
|
||||
onButtonEvent(Key::BUTTON_DPAD_DOWN, pressed, value, button.isAnalog);
|
||||
};
|
||||
|
||||
_impl->_gcController.microGamepad.dpad.left.valueChangedHandler = ^(GCControllerButtonInput *button, float value, BOOL pressed){
|
||||
onButtonEvent(Key::BUTTON_DPAD_LEFT, pressed, value, button.isAnalog);
|
||||
};
|
||||
|
||||
_impl->_gcController.microGamepad.dpad.right.valueChangedHandler = ^(GCControllerButtonInput *button, float value, BOOL pressed){
|
||||
onButtonEvent(Key::BUTTON_DPAD_RIGHT, pressed, value, button.isAnalog);
|
||||
};
|
||||
|
||||
_impl->_gcController.microGamepad.valueChangedHandler = ^(GCMicroGamepad *gamepad, GCControllerElement *element){
|
||||
|
||||
if (element == gamepad.buttonA)
|
||||
{
|
||||
onButtonEvent(Key::BUTTON_A, gamepad.buttonA.isPressed, gamepad.buttonA.value, gamepad.buttonA.isAnalog);
|
||||
}
|
||||
else if (element == gamepad.buttonX)
|
||||
{
|
||||
onButtonEvent(Key::BUTTON_X, gamepad.buttonX.isPressed, gamepad.buttonX.value, gamepad.buttonX.isAnalog);
|
||||
}
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
_impl->_gcController.controllerPausedHandler = ^(GCController* gcCon){
|
||||
|
||||
|
|
Loading…
Reference in New Issue