--require "ia.other"

x=0
rot=0

function mini.init()
    s = surf.load("gfx/logo.gif")
    surf.source(s)
    p = pal.load("gfx/logo.gif")
    pal.set(p)
    pal.trans(255)
    --surf.save(s, "prova.gif", p)

    print("=== PACKAGES LOADED ===")
    for name, value in pairs(package.loaded) do
        print(name, value)
    end
    print("========================")

    f = font.load("font.fnt")
end

function mini.update()
    surf.cls(0)
    draw.surfrot(0, 0, 160, 144, 120, 78, rot)

    draw.text("PRESS START", 60, 110, 28)
    if key.press(key.ESCAPE) then sys.quit() end
    draw.text(sys.fps(), 1, 1, 28)

    if key.press(key.N1) then
        shader.init("lynx.glsl")
        shader.enable()
    end
    if key.press(key.N2) then
        shader.init("gbc.glsl")
        shader.enable()
    end
    if key.press(key.N3) then
        shader.disable()
    end

    local mx, my = mouse.pos()
    draw.rectf(mx, my, 4, 4, 8)
    draw.text(mx .. " " .. my, 1, 8, 8)
    --draw.text(other.peiv(),1,100,4)

    font.current(f)
    font.spacing(0)
    draw.text("0146",100,50,28)
    font.current(font.DEFAULT)
    rot=rot+1
end
