--------------------------------------------------- 
-- FBA Tutorials
--
-- Tutorial / 09b / Gfx Font
--
--------------------------------------------------- 
--
-- In this sample, you can see how to use a cool gfx font
-- inside your FBA program.
--
-- Font made by Boiled Sweets (many thanks :))
--------------------------------------------------- 

-- load our graphic font
image = loadimage("nums.png")
font = loadgfxfont(image, "0123456789", 10)
count = 0

function onmainloop()
        clear(0,0,0)
        
        -- draw counter
        drawgfxtext(font, 10, 10, count)
        
        -- get text width and draw a number aligned to right
        width = gfxtextwidth(font, 9)        
        drawgfxtext(font, screenwidth() - width , 200, 9)

        -- get text width and draw a number aligned to center
        width = gfxtextwidth(font, 69)        
        drawgfxtext(font, screenwidth()/2 - width/2 , 100, 69)
        
        count = count + 1
        
end

function onstylusdown(x,y)
        quit()
end
