--------------------------------------------------- 
-- FBA Tutorials
--
-- Tutorial / 20 / Enlight - The Full Game
--
--------------------------------------------------- 
--
-- This is source code for Enlight - A Full Game.
--
--------------------------------------------------- 

include("resources.fba")
include("menu.fba")
include("game.fba")


STATE_MENU = 0
STATE_PLAYING = 1

CURRENT_STATE = STATE_MENU

LoadGameSettings()



function onmainloop()
        
        if CURRENT_STATE == STATE_MENU then

                DoMenu()

        elseif CURRENT_STATE == STATE_PLAYING then

                DoGame()
        end

        DoStars()
end


function onquit()
        SaveGameSettings()
end


function onstylusup(x,y)

        if CURRENT_STATE == STATE_MENU then

                menu_onstylusup(x, y)

        elseif CURRENT_STATE == STATE_PLAYING then

                game_onstylusup(x, y)
        end

end


function onstylusdown(x,y)

        if CURRENT_STATE == STATE_MENU then

                menu_onstylusdown(x, y)

        elseif CURRENT_STATE == STATE_PLAYING then

                game_onstylusdown(x, y)
        end

end
