47 lines
1.2 KiB
Lua
47 lines
1.2 KiB
Lua
---@meta
|
|
|
|
-- Generated from native/src/bindings/features/buttons.cpp. Do not edit.
|
|
|
|
---@alias Button "up"|"down"|"left"|"right"|"confirm"|"back"
|
|
|
|
-- Roles, not physical buttons: a device maps whatever hardware it has onto them, and
|
|
-- up/down/left/right are the directions node.moveFocus already takes.
|
|
|
|
---@class InputLib
|
|
input = input or {}
|
|
|
|
---Returns the roles this device reports, so an app can label only the actions it has.
|
|
---@return Button[]
|
|
function input.getButtons() end
|
|
|
|
---Whether any button is held.
|
|
---@return boolean
|
|
function input.isAnyPressed() end
|
|
|
|
---Whether a button is held.
|
|
---@param button Button
|
|
---@return boolean
|
|
function input.isPressed(button) end
|
|
|
|
---Whether a button went down since the last poll.
|
|
---@param button Button
|
|
---@return boolean
|
|
function input.wasPressed(button) end
|
|
|
|
---Whether a button came up since the last poll.
|
|
---@param button Button
|
|
---@return boolean
|
|
function input.wasReleased(button) end
|
|
|
|
---Fired when a button goes down.
|
|
---@param button Button
|
|
function on_button_down(button) end
|
|
|
|
---Fired when a button comes up.
|
|
---@param button Button
|
|
function on_button_up(button) end
|
|
|
|
---Tap alias, fired on release like a click, after on_button_up.
|
|
---@param button Button
|
|
function on_button(button) end
|