-
-
Notifications
You must be signed in to change notification settings - Fork 462
coordinate
TIC-80 has a native screen resolution of 240 pixels wide and 136 pixels tall (30:17 aspect ratio). Proportions are kept when resizing, so any reference in the code is considered to be at the "virtual" native resolution, no matter if you are working with a 4K monitor at full-screen.
The coordinate, as with most devices, start from the top-left corner of the screen.
X refers to the horizontal coordinate starting from 0 (left side) to 239 (right side). Y refers to the vertical coordinate starting from 0 (top) to 135 (bottom).
Here's a picture:
and the code for it:
--Coordinate system demo
function TIC()
cls(0)
--grid x
for x=0,240,32 do
line(x,0,x,136,8)
end
--grid y
for y=0,136,32 do
line(0,y,240,y,8)
end
--grid cross
for x=0,240,32 do
for y=0,136,32 do
pix(x,y,6)
end
end
--arrows
line(8,8,210,8,6)
line(210,8,210-6,8-2,6)
line(210,8,210-6,8+2,6)
line(8,8,8,120,6)
line(8,120,8-2,120-6,6)
line(8,120,8+2,120-6,6)
--labels
for x=0,240,64 do
for y=0,136,64 do
print('('..x..','..y..')',x+2,y+2)
end
end
--reference
print('(X,Y)',12,12)
end
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)