There are quite a number of helper libraries out there, ranging from vector classes to complete frameworks like Pölygamy, but I decided to release the byproducts of projects anyway.
And thus hump - LÖVE Helper Utilities for Massive Progression - was born.
Currently it features a matured vector class, a simple and easy class system, a gamestate system, timers and tweens, signals and slots, and a camera with locking and movement smoothing
I may add other things like some time in the future.
Hump differs from other libraries in that every component is independent of the remaining ones (well, apart from camera.lua, which needs the vector class), meaning that you can pick and choose what you need and what you don't. Hump's footprint is very small and it should fit nicely into your projects.
Sourcecode and documentation are available on github and readthedocs:
Documentation: http://hump.readthedocs.org
Sourcecode: http://github.com/vrld/hump
HUMP - yet another set of helpers
- nevon
- Commander of the Circuloids
- Posts: 938
- Joined: Thu Feb 14, 2008 8:25 pm
- Location: Stockholm, Sweden
- Contact:
Re: HUMP - yet another set of helpers
Nice! That's great, and I will most likely use this in upcoming projects. What license is it under?
Re: HUMP - yet another set of helpers
I knew i forgot something, so, ahem:
Helper Utilities for a Multitude of Problems is free software under the (modified) MIT license. Do whatever you want with it
Helper Utilities for a Multitude of Problems is free software under the (modified) MIT license. Do whatever you want with it
Re: HUMP - yet another set of helpers
Lövely! Gotta love the open source!
Last edited by Chief on Sat Jun 04, 2011 9:11 pm, edited 1 time in total.
- nevon
- Commander of the Circuloids
- Posts: 938
- Joined: Thu Feb 14, 2008 8:25 pm
- Location: Stockholm, Sweden
- Contact:
Re: HUMP - yet another set of helpers
So, I wanted to use the gamestate lib and the class lib. The documentation for the class one is great, but there isn't any for the other one. It seems straightforward enough for the most part; the only thing I'm wondering about is how to use the enter and leave states. Got an example to show?
Re: HUMP - yet another set of helpers
The enter and leave functions are called when you use Gamestate.switch(to, ...).
The first argument to the enter function is the previous state, the rest are the remaining arguments passed to Gamestate.switch. The previous-state-as-argument mostly a hack to retrieve state values not passed to Gamestate.switch but also to make the switch call not too verbose.
The leave is called right before the state is switched (and before the enter of the next state). I mostly use this for stopping music or resetting fonts.
An example:
For a working example see here: http://github.com/vrld/notalone/tree/master/state/
The first argument to the enter function is the previous state, the rest are the remaining arguments passed to Gamestate.switch. The previous-state-as-argument mostly a hack to retrieve state values not passed to Gamestate.switch but also to make the switch call not too verbose.
The leave is called right before the state is switched (and before the enter of the next state). I mostly use this for stopping music or resetting fonts.
An example:
Code: Select all
Gamestate.titlescreen = Gamestate.new()
local st = Gamestate.titlescreen
function st:enter()
start_music()
love.graphics.setBackgroundColor(10,20,30)
love.graphics.setColor(0,0,0)
end
function st:leave()
stop_music()
end
function st:keyreleased(key)
if key == 'return' then
Gamestate.switch(Gamestate.game, self.playerName)
end
end
[...]
Gamestate.game = Gamestate.new()
local st = Gamestate.game
function st:enter(pre, playerName)
if pre == Gamestate.pause then return end
self.playerName = playerName
end
[...]
- nevon
- Commander of the Circuloids
- Posts: 938
- Joined: Thu Feb 14, 2008 8:25 pm
- Location: Stockholm, Sweden
- Contact:
Re: HUMP - yet another set of helpers
I'm using the gamestate lib now, and it is incredibly easy to use. Thanks a bunch for making and releasing this.
Re: HUMP - yet another set of helpers
Good job with the documentation, vrld. You're being a model to all library makers here.
There's a cosmetic mark-up problem after function Gamestate.mousereleased(x,y,btn) that you might want to correct some time.
There's a cosmetic mark-up problem after function Gamestate.mousereleased(x,y,btn) that you might want to correct some time.
Re: HUMP - yet another set of helpers
I'm doing something pretty wrong with the gamestate code, I just don't know what.
http://sslaxx.twu.net/EggTester.love - just started to convert one section of the code so far to use gamestates, but it produces this error:
http://sslaxx.twu.net/EggTester.love - just started to convert one section of the code so far to use gamestates, but it produces this error:
Help?boot [string "Code/gamestate.lua"]:28: attempt to index field 'current' (a nil value) stack traceback:
[string "boot.lua"]:833: in function 'error_printer'
[string "boot.lua"]:768: in function <[string "boot.lua"]:766>
[string "Code/gamestate.lua"]:28: in function 'update'
[string "boot.lua"]07: in function <[string "boot.lua"]:295>
[C]: in function 'xpcall'
[string "boot.lua"]:840: in main chunk
Re: HUMP - yet another set of helpers
Thanks, I missed that.pekka wrote:There's a cosmetic mark-up problem after function Gamestate.mousereleased(x,y,btn) that you might want to correct some time.
I've created a git project page with a more usable documentation: http://vrld.github.com/hump/
That error occurs because you did not use Gamestate.switch() to enter your title gamestate.Sslaxx wrote:Help?
Rather than calling Gamestate.TitleScreen:enter() you need to do Gamestate.switch(Gamestate.TitleScreen) - preferably in love.load() so you can be sure the state exists.
I pointed that out in the new documentation and also added a dummy initial state to gamestate.lua which will throw errors at you if did not switch to a valid state.
Who is online
Users browsing this forum: Google Adsense [Bot] and 1 guest