Source

lovewars / main.lua

Full commit
--[[
parts of code are taken from "Fistful of Beef" by LÖVE-Party (c)
http://github.com/LOVE-Party/Love-LD18
and are
Copyright (c) 2010 LÖVE-Party
--]]

-- libraries
require("lib/gamestate")
require("lib/SECS")
require("lib/mrpas")
require("lib/SaveTableToFile")

-- utilities
require("utils")

--states requires
require("states/requirements")
require("states/intro")
require("states/menu")
require("states/game")
require("states/battle")
require("states/gameover")

--- love.load 
-- initial function loading all
function love.load()
  love.graphics.setBackgroundColor(50, 50, 50)
  love.graphics.setCaption("LoveWars")
  love.graphics.setFont(18)

  -- Set Random Seed
  math.randomseed(os.time());
  math.random()
  math.random()
  math.random()

  -- Set filesystem identity
  love.filesystem.setIdentity("lovewars")

  images = {}
  loadfromdir(images, "images_auto", "png", love.graphics.newImage)

  sounds = {}
  loadfromdir(sounds, "sounds_auto", "ogg", love.sound.newSoundData)

  music = {}
  loadfromdir(music, "music_auto", "ogg", love.audio.newSource)

  fonts = {}
  fontCacheInit(nil,nil,10,16,20)

  Gamestate.registerEvents()
  Gamestate.switch(Gamestate[(arg[2] and arg[2]:match("--state=(.+)") or "requirements")])
end