Skip to content
Luna-Rex edited this page Jan 15, 2019 · 10 revisions

TIC coordinate system

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:

TIC coordinate

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
Clone this wiki locally