require "menu"
require "game"
require "playerturn"
require "omnipotentturn"
require "end"

function love.load()
    gamestate = "menu"
    isFocused = true
    screenLoaded = false
    resourceTextureArray = {}
    resourceAudioArray = {}
    tempDataArray = {}
    pressStart2P_12p = love.graphics.newFont("assets/PressStart2P.ttf", 11)
    pressStart2P_20p = love.graphics.newFont("assets/PressStart2P.ttf", 42)
end
function love.focus(f)
    if not f then
    isFocused = false
    else
    isFocused = true
    end
end
function love.mousepressed(x, y, button)
    if gamestate == "menu" then
        menu_handleMouseInput(x, y, button, "press")
    end
    if gamestate == "game" then
        game_handleMouseInput(x, y, button, "press")
    end
end
function love.update()
    if gamestate == "menu" then
        if screenLoaded == false then
            menu_load()
        end
        menu_update(dt)
    elseif gamestate == "game" then
        if screenLoaded == false then
            game_load()
        end
        game_update(dt)
    end
end
function changeScreenCleanly(screento)
    resourceTextureArray = 0
    resourceAudioArray = 0
    tempDataArray = 0
    gamestate = screento
    resourceTextureArray = {}
    resourceAudioArray = {}
    tempDataArray = {}
    screenLoaded = false
end
function checkButton(inputx, inputy, x, y, width, height)
    if inputx > x and inputx < x + width
    and inputy > y and inputy < y + height
    then return true
    else
    return false
    end
end
function love.draw()
    if gamestate == "menu" then
        menu_draw()
    elseif gamestate == "game" then
        game_draw()
    elseif gamestate == "end" then
        end_draw()
    end
end