-- title:  Font Routine (1 bitplane)
-- author: Mantratronic / RiFT
-- desc:   font writer@demo framework
-- script: lua

package.path=package.path..";C:\\Users\\micro\\AppData\\Roaming\\com.nesbox.tic\\TIC-80\\rift\\?.lua"	-- jtruk
package.path=package.path..";C:\\Users\\Ronan\\AppData\\Roaming\\com.nesbox.tic\\TIC-80\\rift\\?.lua"	-- Mantratronic
package.path=package.path..";C:\\Users\\Matt\\AppData\\Roaming\\com.nesbox.tic\\TIC-80\\rift\\?.lua"	-- jynx

local R={}
require("./sys/sys")(R)
require("./font/font")(R)

local FONT=nil

function BOOT()
  FONT=R.Font:new()
  local data=require("./data/font/nucampi-8x16/nucampi-8x16")
  FONT:load(data)
end

function TIC()
  R.tryBreak()
  cls(0)

  -- some text
  local texts = {
    {"ABCDEFGHIJKLMOPQRSTUVWXYZ","Zabcdefghijklmnopqrstuvwxyz","@0!1'2+3,4-5.6/7:8=9?","Hast Du nicht gesehen!"},
    {"THE QUICK BROWN","FOX JUMPS OVER", "?THE L@ZY DOG!", "42.AGO / 21:GUNS", "RIFT -IS- BACK"},
    {"This is the new style!","Nucampi 8x16,","is here to stay.","@ready for the","FUNKY SHIT?"},
  }
  local text=texts[1+(time()//2000)%#texts]

  for i=1,#text do
    local w=FONT:width(text[i])
    FONT:print(text[i],120-(w/2),50+(20*(i-#text/2)))
  end
end

-- <PALETTE>
-- 000:1a1c2c5d275db13e53ef7d57ffcd75a7f07038b76425717929366f3b5dc941a6f673eff7f4f4f494b0c2566c86333c57
-- </PALETTE>

