Skip to content
MonstersGoBoom edited this page Jun 5, 2018 · 27 revisions

textri (0.46)

textri x1 y1 x2 y2 x3 y3 u1 v1 u2 v2 u3 v3 [use_map=false] [colorkey=-1]

Parameters:

  • x1 : the x coordinate of the first triangle corner
  • y1 : the y coordinate of the first triangle corner
  • x2 : the x coordinate of the second triangle corner
  • y2 : the y coordinate of the second triangle corner
  • x3 : the x coordinate of the third triangle corner
  • y3 : the y coordinate of the third triangle corner

UV Coordinates

These can be thought of as the window inside image ram, or map ram

  • u1 : the U coordinate of the first triangle corner

  • v1 : the V coordinate of the first triangle corner

  • u2 : the U coordinate of the second triangle corner

  • v2 : the V coordinate of the second triangle corner

  • u3 : the U coordinate of the third triangle corner

  • v3 : the V coordinate of the third triangle corner

  • use_map : this is to use image vram directly , or map ram

  • colorkey : this is the color to ignore when drawing, transparent

Description:

It renders a triangle filled with texture from image ram or map ram

Example:

-- title:  triangle demo
-- author: MonstersGoBoom
-- desc:   wiki demo for textri
-- script: lua
-- input:  gamepad

usize = 32
vsize = 32
function TIC()
  cls(1)
  if btn(0) then usize=usize-1 end
  if btn(1) then usize=usize+1 end
  if btn(2) then vsize=vsize-1 end
  if btn(3) then vsize=vsize+1 end

-- draw a scaling view into the map ram 

  textri(0,0,
         64,0,
         0,64,    
         0,0,
         usize,0,
         0,vsize,
         true,
         14)
  textri(64,0,
         0,64,
         64,64,    
         usize,0,
         0,vsize,
         usize,vsize,
         true,
         14)
end
Clone this wiki locally