-
-
Notifications
You must be signed in to change notification settings - Fork 489
TimotheeGreg edited this page Aug 27, 2023
·
23 revisions
You can download a quick API reference sheet suitable for viewing or printing here: PDF (OUTDATED). The Wiki also includes a Cheatsheet for fast reference.
Callbacks are functions that your game defines and that TIC-80 calls automatically. Every game at a minimum must define a TIC
function.
- TIC - Called 60 times per second (60 FPS); the main update/draw callback. Required.
- BOOT - Called once when yout cartridge is first booted
-
SCN(n) - (deprecated as of 0.90, use
BDR(n)
now instead) - BDR(n) - Called prior to each scanline/borderline render (allowing for palette swaps, etc).
- OVR - Called last and draws to a separate layer (using a separate palette).
- MENU - Used to handle custom items in the Game Menu (introduced in 1.0)
-- cartridge is booted
BOOT()
-- frame begins (at 60 frames per second)
TIC()
OVR()
BDR(0..143)
-- frame ends
SCN
callsbacks are not included in the above table because SCN
has been deprecated. You should now use BDR instead of SCN
.
- circ - Draw a filled circle
- circb - Draw a circle border
- elli - Draw a filled ellipse (0.90)
- ellib - Draw an ellipse border (0.90)
- clip - Set the screen clipping region
- cls - Clear the screen
- font - Print a string using foreground sprite data as the font
- line - Draw a straight line
- map - Draw a map region
- pix - Get or set the color of a single pixel
- print - Print a string using the system font
- rect - Draw a filled rectangle
- rectb - Draw a rectangle border
- spr - Draw a sprite or composite sprite
- tri - Draw a filled triangle
- trib - Draw a triangle border (0.90)
- textri - Draw a triangle filled with texture
- btn - Get gamepad button state in current frame
- btnp - Get gamepad button state according to previous frame
- key - Get keyboard button state in current frame
- keyp - Get keyboard button state relative to previous frame
- mouse - Get XY and press state of mouse/touch
- memcpy - Copy bytes from one location in RAM to another
- memset - Set sequential bytes in RAM to a given value
- pmem - Access or update the persistent memory
- peek - Read a byte from an address in RAM
- peek1 - Read a single bit from an address in RAM (1.0)
- peek2 - Read two bit value from an address in RAM (1.0)
- peek4 - Read a nibble (4bit) value from an address RAM
- poke - Write a byte value to an address in RAM
- poke1 - Write a single bit to an address in RAM (1.0)
- poke2 - Write a two bit value to an address in RAM (1.0)
- poke4 - Write a nibble (4bit) value to an address in RAM
- sync - Copy banks of RAM (sprites, map, etc) to and from the cartridge
- vbank - Switch the 16kb of banked video RAM
TIC-80 tiny computer https://tic80.com | Twitter | Telegram | Terms
Built-in Editors
Console
Platform
RAM & VRAM | Display | Palette | Bits per Pixel (BPP) |
.tic
Format | Supported Languages
Other
Tutorials | Code Snippets | Libraries | External Tools | FFT
API
- BDR (0.90)
- BOOT (1.0)
- MENU
- OVR (deprecated)
- SCN (deprecated)
- TIC
- btn & btnp
- circ & circb
- clip
- cls
- elli & ellib (0.90)
- exit
- fget & fset (0.80)
- font
- key & keyp
- line
- map
- memcpy & memset
- mget & mset
- mouse
- music
- peek, peek4
- peek1, peek2 (1.0)
- pix
- pmem
- poke, poke4
- poke1, poke2 (1.0)
- rect & rectb
- reset
- sfx
- spr
- sync
- ttri (1.0)
- time
- trace
- tri & trib (0.90)
- tstamp (0.80)
- vbank (1.0)