diff --git a/index.html b/index.html index d439319..ae1f9fd 100644 --- a/index.html +++ b/index.html @@ -384,9 +384,9 @@ result:foo() -- error: method does not exist
Parameters: | [optional vector]pos : |
Initial position of the camera. Defaults to (0,0) . | |
---|---|---|---|
[optional number]zoom : |
+ |||
[optional number]zoom : |
Initial zoom. Defaults to 1 . | ||
[optional number]rotation : |
+ |||
[optional number]rotation : |
Initial rotation in radians. Defaults to 0 . | ||
Returns: | a new camera object |
Useful to separate different states of your game (hence "gamestate") like title screens,
+ level loading, main game, etc. Each gamestate can have it's own update()
, draw()
,
+ keyreleased()
, keypressed()
and mousereleased()
which correspond
+ to the ones defined in love. See the callback list for more details.
Additionally, each gamestate can define a enter(pre, ...)
and leave()
function,
+ which are called when using Gamestate.switch(to, ...)
. Do not attempt to use these functions
+ yourself to initialize the first gamestate, use the switch
function instead.
The module defines the following functions: +
Gamestate.new() | New gamestate |
Gamestate.switch(to, ...) | Switch gamestate |
Gamestate.update(dt) | Call update callback |
Gamestate.draw() | Call draw callback |
Gamestate.keypressed(key, unicode) | Call keypressed callback |
Gamestate.keyreleased(key) | Call keyreleased callback |
Gamestate.mousereleased(x,y,btn) | Call mousereleased callback |
Gamestate.registerEvents() | Register all callbacks |
Returns: | The new (but empty) gamestate object. |
---|
Calls leave()
on the currently active gamestate.
Calls enter(current, ...)
on the target gamestate, where current
+ is the gamestate before the switch and ...
are the additionals arguments given
+ to Gamestate.switch
.
Parameters: | [gamestate]to : | target gamestate. |
---|---|---|
... : | additional arguments to pass | |
Returns: | the result of to:enter(current, ...) |
update(dt)
on current gamestate.
+ draw()
on current gamestate.
+ keypressed(key, unicode)
on current gamestate.
+ keyreleased(key)
on current gamestate.
+ mousereleased(x,y,btn)
on the current gamestate.
+ love.*
routines.
+ It is an error to call this anywhere else than love.load()
, since it overwrites the
+ callbacks. Dont worry though, your callbacks will still be executed.
enter(previous, ...) |
+ Gets called upon entering the state. Don't call this yourself, use
+ Gamestate.switch instead. |
leave() |
+ Gets called upon leaving the state. The same warning as with enter applies. |
update(dt) |
+ Manully called by Gamestate.update , or automatically like love.update
+ when using Gamestate.registerEvents() . |
draw() |
+ Manully called by Gamestate.draw , or automatically like love.draw |
keypressed(key, unicode) |
+ Manully called by Gamestate.keypressed , or automatically like love.keypressed |
keyreleased(key) |
+ Manully called by Gamestate.keyreleased , or automatically like love.keyreleased |
mousereleased(x,y,btn) |
+ Manully called by Gamestate.mousereleased , or automatically like love.mousereleased |