require "utils.app"
require "modules.score"
require "modules.rooms"
require "stages.titles"
require "stages.editor"
require "stages.game"
require "utils.palfade"


function reload_textures()
    if surf_sprites then surf.free(surf_sprites) end
    surf_sprites = surf.load("gfx/sprites.gif")
    if surf_tiles then surf.free(surf_tiles) end
    surf_tiles = surf.load("gfx/tiles.gif")
    palfade.original = pal.load("gfx/tiles.gif")
    pal.set(palfade.original)
end

function mini.init()
    reload_textures()
    pal.trans(0)

    rooms.init()
    shader.init("lynx.glsl")
    --titles.enable()
    game.enable()
    --if sys.debug() then
    --   editor.enable()
    --else
    --    game.enable()
    --end
    sprites.add_from_room(rooms.pos.x, rooms.pos.y)
end

function mini.update()
    tweening.update(sys.delta())
    app.update()
end

