TUP Base - Another library. Has hooks!
Posted: Sun Mar 29, 2009 8:36 pm
Here's a library (more like a game base) I made. Everything is based around hooks now.
Features:
Download: http://tup-love-projects.googlecode.com ... upbase.lua
Enjoy.
Features:
Example code:- Tab restarter.
- Hooks!
- Debug mode.
- Game state basics.
- Utility functions:
+ love.graphics.setDrawMode
+ love.graphics.setAlpha
+ table.Count
Code: Select all
require("tupbase.lua")
exl = {}
function load()
game.media = { cursor = love.graphics.newImage( "media/cursor.png" ) }
game.v.state = "menu"
end
function exl.draw()
if game.v.state == "menu" then
love.graphics.draw( game.media.cursor, love.mouse.getX(), love.mouse.getY() )
end
end
function exl.update(dt)
end
function exl.keypressed(key)
if key == love.key_escape then
hook.Call("beforeexit")
love.system.exit()
end
end
function nooo()
msg("Nooo don't exit! D:")
end
-- Add hooks.
hook.Add("draw", dfr.draw)
hook.Add("update", dfr.update)
hook.Add("keypressed", dfr.keypressed)
hook.Add("beforeexit", nooo)
Enjoy.