Repository navigation
btnr
btnr(id) -> is_releasedbtnr() -> GAMEPADS data
-
id : id (0..31) of the button we want to interrogate (see the key map for reference or type
help buttonsin console).
- is_released : button was released since the last frame (true/false)
- GAMEPADS data : 32-bit value that represents the buttons released since the last frame
This function returns true only if the button with the supplied id was pressed in the previous frame and is not pressed now. Use btnp for the opposite edge (newly pressed) and btn for the held state.
-- count the shots released during a frame
shots = 0
function TIC()
cls(0)
if btnr(4) then
shots = shots + 1
end
print("released: " .. shots, 10, 10, 12)
endTIC-80 tiny computer https://tic80.com | Twitter | Telegram | Terms
Built-in Editors
Console
save | export | load | import | menu | config | surf | shelf | demo | eval
Platform
RAM | VRAM | Display | Palette | Bits per Pixel (BPP) |
.ticFormat | Supported Languages
Other
Tutorials | Code Snippets | Libraries | External Tools | FFT
API
Callbacks
Input
Drawing
circ | circb | clip | cls | elli | ellib | font | line | map | paint | pix | print | rect | rectb | rrect | rrectb | spr | tri | trib | ttri | fill patterns
- textri (deprecated)
Sound
Memory
memcpy | memset | mget | mset | peek | poke | pmem | sync | vbank
System