Difference between revisions of "Gb.buttons.held"
From Gamebuino Wiki
(page creation) |
(→Example: fixed link to example) |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
− | {{ | + | {{lowercase}} |
__NOTOC__ | __NOTOC__ | ||
== Description == | == Description == | ||
Line 15: | Line 15: | ||
== Example == | == Example == | ||
− | <gistit>https://github.com/Rodot/Gamebuino/blob/master | + | <gistit>https://github.com/Rodot/Gamebuino/blob/master/examples/5.Reference/buttons/buttons/buttons.ino</gistit> |
== See also == | == See also == | ||
*[[gb.buttons.repeat]] | *[[gb.buttons.repeat]] |
Latest revision as of 2016-12-18T20:21:22
Description
Function used to know when a given button is held for a given duration.
Syntax
gb.buttons.held(button, duration);
Parameters
- button (byte): the identifier of the button, to choose from
BTN_A, BTN_B, BTN_C, BTN_UP, BTN_RIGHT, BTN_DOWN, BTN_LEFT
- duration (byte): the duration in number of frames (20 frames per second by default)
Returns
- boolean: returns true if the selected button is held for the given duration. Only returns true once, if you want to it to happen every X frames use gb.buttons.repeat
Example