@@ -80,6 +80,8 @@ Delegate<const Float2&, MouseButton> Input::MouseDoubleClick;
|
||||
Delegate<const Float2&, float> Input::MouseWheel;
|
||||
Delegate<const Float2&> Input::MouseMove;
|
||||
Action Input::MouseLeave;
|
||||
Delegate<InputGamepadIndex, GamepadButton> Input::GamepadButtonDown;
|
||||
Delegate<InputGamepadIndex, GamepadButton> Input::GamepadButtonUp;
|
||||
Delegate<const Float2&, int32> Input::TouchDown;
|
||||
Delegate<const Float2&, int32> Input::TouchMove;
|
||||
Delegate<const Float2&, int32> Input::TouchUp;
|
||||
@@ -1027,6 +1029,19 @@ void InputService::Update()
|
||||
break;
|
||||
}
|
||||
}
|
||||
// TODO: route gamepad button events into global InputEvents queue to improve processing
|
||||
for (int32 i = 0; i < Input::Gamepads.Count(); i++)
|
||||
{
|
||||
auto gamepad = Input::Gamepads[i];
|
||||
for (int32 buttonIdx = 1; buttonIdx < (int32)GamepadButton::MAX; buttonIdx++)
|
||||
{
|
||||
GamepadButton button = (GamepadButton)buttonIdx;
|
||||
if (gamepad->GetButtonDown(button))
|
||||
Input::GamepadButtonDown((InputGamepadIndex)i, button);
|
||||
else if (gamepad->GetButtonUp(button))
|
||||
Input::GamepadButtonUp((InputGamepadIndex)i, button);
|
||||
}
|
||||
}
|
||||
|
||||
// Update all actions
|
||||
for (int32 i = 0; i < Input::ActionMappings.Count(); i++)
|
||||
|
||||
@@ -113,6 +113,16 @@ public:
|
||||
/// </summary>
|
||||
API_EVENT() static Action MouseLeave;
|
||||
|
||||
/// <summary>
|
||||
/// Event fired when gamepad button goes down.
|
||||
/// </summary>
|
||||
API_EVENT() static Delegate<InputGamepadIndex, GamepadButton> GamepadButtonDown;
|
||||
|
||||
/// <summary>
|
||||
/// Event fired when gamepad button goes up.
|
||||
/// </summary>
|
||||
API_EVENT() static Delegate<InputGamepadIndex, GamepadButton> GamepadButtonUp;
|
||||
|
||||
/// <summary>
|
||||
/// Event fired when touch action begins.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user