TUP Base - Another library. Has hooks!

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
thelinx
The Strongest
Posts: 857
Joined: Fri Sep 26, 2008 3:56 pm
Location: Sweden

TUP Base - Another library. Has hooks!

Post by thelinx »

Here's a library (more like a game base) I made. Everything is based around hooks now.

Features:
- Tab restarter.
- Hooks!
- Debug mode.
- Game state basics.
- Utility functions:
+ love.graphics.setDrawMode
+ love.graphics.setAlpha
+ table.Count
Example code:

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)
Download: http://tup-love-projects.googlecode.com ... upbase.lua

Enjoy.
Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests