Source

Image-Breakout / main.lua

--[[----------------------------------------------------------------------------
Copyright (c) 2011
Programmer: Danny Fritz <dannyfritz@gmail.com>
Artist: Josh Brinkley <computercodemonkey@gmx.com>
http://creativecommons.org/licenses/by/3.0/
Licensed under the Creative Commons Attribution 3.0 Unported License.
--]]----------------------------------------------------------------------------

require 'lib.middleclass'
require 'lib.middleclass-extras'

require 'lua.Gamestate'

math.randomseed(os.time())
math.random(); math.random();

--------------------------------------------------------------------------------
function love.load()
	gamestate = Gamestate:new()
	love.graphics.setFont(32)
	gamestate:gotoState('Breakout')
end

--------------------------------------------------------------------------------
function love.update(dt)
	gamestate:update(dt)
end

--------------------------------------------------------------------------------
function love.draw()
	gamestate:draw()
end

--------------------------------------------------------------------------------
function love.focus(f)
	gamestate:focus(f)
end

--------------------------------------------------------------------------------
function love.joystickpressed(joystick, button)
	gamestate:joystickpressed(joystick, button)
end

--------------------------------------------------------------------------------
function love.joystickreleased(joystick, button)
	gamestate:joystickreleased(joystick, button)
end

--------------------------------------------------------------------------------
function love.keypressed(key, unicode)
	gamestate:keypressed(key, unicode)
end

--------------------------------------------------------------------------------
function love.keyreleased(key)
	gamestate:keyreleased(key)
end

--------------------------------------------------------------------------------
function love.mousepressed(x, y, button)
	gamestate:mousepressed(x, y, button)
end

--------------------------------------------------------------------------------
function love.mousereleased(x, y, button)
	gamestate:mousereleased(x, y, button)
end

--------------------------------------------------------------------------------
function love.quit()
	gamestate:quit()
end