Skip to content
Vadim Grigoruk edited this page Nov 22, 2026 · 1 revision
  • btnr(id) -> is_released
  • btnr() -> GAMEPADS data

Parameters

  • id : id (0..31) of the button we want to interrogate (see the key map for reference or type help buttons in console).

Returns

  • 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

Description

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.

Example

-- 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)
end

Home
Tips for newcomers

Built-in Editors

Code | Sprites | Maps | SFX | Music

Console

All commands

save | export | load | import | menu | config | surf | shelf | demo | eval 

Platform

RAM | VRAM | Display | Palette | Bits per Pixel (BPP) | .tic Format | Supported Languages

Other

Tutorials | Code Snippets | Libraries | External Tools | FFT


API

All API functions

Callbacks

TIC | BOOT | MENU | BDR

  • SCN (deprecated)
  • OVR (deprecated)

Input

btn | btnp | btnr | key | keyp | keyr | mouse

Drawing

circ | circb | clip | cls | elli | ellib | font | line | map | paint | pix | print | rect | rectb | rrect | rrectb | spr | tri | trib | ttri | fill patterns

Sound

music | sfx | FFT | VQT

Memory

memcpy | memset | mget | mset | peek | poke | pmem | sync | vbank

System

exit | reset | time | tstamp | trace

Clone this wiki locally