Skip to content

Commit 55cf45d

Browse files
committed
Add gamepad related callbacks
Finally ...
1 parent f51eb9c commit 55cf45d

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

ScreenManager.lua

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,78 @@ function ScreenManager.wheelmoved( x, y )
402402
ScreenManager.peek():wheelmoved( x, y );
403403
end
404404

405+
---
406+
-- Reroutes the gamepadaxis callback to the currently active screen.
407+
-- @param joystick (Joystick) The joystick object.
408+
-- @param axis (GamepadAxis) The joystick object.
409+
-- @param value (number) The new axis value.
410+
--
411+
function ScreenManager.gamepadaxis( joystick, axis, value )
412+
ScreenManager.peek():gamepadaxis( joystick, axis, value );
413+
end
414+
415+
---
416+
-- Reroutes the gamepadpressed callback to the currently active screen.
417+
-- @param joystick (Joystick) The joystick object.
418+
-- @param button (GamepadButton) The virtual gamepad button.
419+
--
420+
function ScreenManager.gamepadpressed( joystick, button )
421+
ScreenManager.peek():gamepadpressed( joystick, button );
422+
end
423+
424+
---
425+
-- Reroutes the gamepadreleased callback to the currently active screen.
426+
-- @param joystick (Joystick) The joystick object.
427+
-- @param button (GamepadButton) The virtual gamepad button.
428+
--
429+
function ScreenManager.gamepadreleased( joystick, button )
430+
ScreenManager.peek():gamepadreleased( joystick, button );
431+
end
432+
433+
---
434+
-- Reroutes the joystickadded callback to the currently active screen.
435+
-- @param joystick (Joystick) The newly connected Joystick object.
436+
--
437+
function ScreenManager.joystickadded( joystick )
438+
ScreenManager.peek():joystickadded( joystick );
439+
end
440+
441+
---
442+
-- Reroutes the joystickhat callback to the currently active screen.
443+
-- @param joystick (Joystick) The newly connected Joystick object.
444+
-- @param hat (number) The hat number.
445+
-- @param direction (JoystickHat) The new hat direction.
446+
--
447+
function ScreenManager.joystickhat( joystick, hat, direction )
448+
ScreenManager.peek():joystickhat( joystick, hat, direction );
449+
end
450+
451+
---
452+
-- Reroutes the joystickpressed callback to the currently active screen.
453+
-- @param joystick (Joystick) The newly connected Joystick object.
454+
-- @param button (number) The button number.
455+
--
456+
function ScreenManager.joystickpressed( joystick, button )
457+
ScreenManager.peek():joystickpressed( joystick, button );
458+
end
459+
460+
---
461+
-- Reroutes the joystickreleased callback to the currently active screen.
462+
-- @param joystick (Joystick) The newly connected Joystick object.
463+
-- @param button (number) The button number.
464+
--
465+
function ScreenManager.joystickreleased( joystick, button )
466+
ScreenManager.peek():joystickreleased( joystick, button );
467+
end
468+
469+
---
470+
-- Reroutes the joystickremoved callback to the currently active screen.
471+
-- @param joystick (Joystick) The now-disconnected Joystick object.
472+
--
473+
function ScreenManager.joystickremoved( joystick )
474+
ScreenManager.peek():joystickremoved( joystick );
475+
end
476+
405477
-- ------------------------------------------------
406478
-- Return Module
407479
-- ------------------------------------------------

0 commit comments

Comments
 (0)