Commit Graph

45 Commits

Author SHA1 Message Date
Matthias Richter
3ac246dd33 Fix(?) #95: hump.gamestate causes random crashes
Overwriting love.errorhandler() causes trouble. This callback must
return a game loop to display the error (see http://love2d.org/wiki/love.errorhandler).
Overwriting this callback in gamestate.registerEvents() would return
GS.errorhandler(), which would return nil and thus (maybe) causing LÖVE
to crash. On the other hand, @lemilonkh reports that LÖVE may still
crash if the love.errorhandler() is returned instead of
GS.errorhandler(), so the underlying issue might be different.

In any case, don't overwrite love.errorhandler, unless you know what you
do.
2018-06-11 18:37:51 +02:00
Andrew Minnich
23ac57ae5b
remove leftover print 2018-05-13 20:26:02 -04:00
Matthias Richter
a905c592a9 Rename callback: errhand to errorhandler 2018-05-05 13:38:36 +02:00
Kingdaro
9a1c4c8b78 Merge remote-tracking branch 'refs/remotes/origin/master' into vrld/master
Resolved conflicts
2016-05-23 17:52:49 -04:00
Matthias Richter
f851254f26 Fix #52 - Gamestate require init function.
Use __NULL__ when init is not defined in the state.
2015-10-13 08:11:49 +02:00
vrld
ca7fa8acb3 (Issue #49) Don't overwrite state.init on gamestate.switch 2015-10-07 21:48:20 +02:00
Matthias Richter
3c666c558b Fix #46: GS.switch should halt current state cycle
`switch`, `push` and `pop` now set a flag marking the new state as
dirty. Dirty states will not receive any callbacks except `update`.
Before executing `update` the state is marked as clean, so it will
receive callbacks from thereon.
2015-05-30 16:41:37 +02:00
Matthias Richter
5c9d51d356 Fetch event callbacks from love instead of hardcoding it 2015-05-30 16:19:26 +02:00
Harris Munir
f984cc87e6 add mousemoved callback to gamestate callbacks (added in LOVE 0.9.2) 2015-03-18 20:08:38 -05:00
vrld
b18c399def Add missing argument to gs:resume(pre, ...) 2014-12-16 18:07:32 +01:00
xpol
bdd9ad5c04 Fixes wrong arg #1 for resume(). 2014-12-15 15:06:05 +08:00
vrld
526ca620c9 Merge pull request #36 from jessevanherk/master
add assertions to catch incorrect colon-calls to gamestate
2014-08-22 13:57:47 +02:00
Matthias Richter
af8f19a48e Forward arguments from GS.pop() to state:resume() 2014-08-22 13:57:02 +02:00
Matthias Richter
bd10ec4caf (Fix #34) Add callback for returning from push()/pop()
state:resume() will be called on the state that issued a GS.push()
after the pushed state is popped from the stack.
2014-08-22 13:42:17 +02:00
Jesse van Herk
db9a576aa7 cleanup indenting to match origin style 2014-07-01 11:42:42 -06:00
Jesse van Herk
ed2b38952a Add assertions for : calls, avoid bad recursion 2014-07-01 11:38:07 -06:00
Kevin Bradshaw
21d87e5119 Added gamepadreleased to all_callbacks 2014-02-08 16:49:34 +01:00
Matthias Richter
d42244ba35 [Gamestate] Undo last commit. Add all 0.9 callbacks. 2013-12-16 16:35:06 +01:00
Kingdaro
a7880c5098 add all callbacks for 0.9.0 2013-12-15 00:02:09 -05:00
Matthias Richter
4372c6404c [Gamestate] Add love.textinput to default callback list 2013-12-14 13:01:45 +01:00
Landon Manning
d697664e27 Update for 0.9.0 2013-11-10 00:16:35 -04:00
Matthias Richter
cea730deac Fix bug in GS.push(). 2013-08-24 22:58:30 +02:00
Matthias Richter
87b82750ff Localize function registry to Gamestate.switch(). 2013-08-19 14:10:00 +02:00
Matthias Richter
5c06f3d3d0 [gamestate] Add .current(). Add gamestate stack.
New methods:

function GS.current()
    retrieves currently active gamestate (i.e. the state on top of the
    stack)

function GS.push(state, ...)
    Pushes a state on the stack. Calls state:enter(...), but *not*
    state:leave() on the previous state.

function GS.pop()
    Pops a state from the stack, provided that there are states to pop.
    Calls state:leave() on the state on top of the stack before popping.
2013-08-05 16:30:30 +02:00
Carlo Cabanilla
11cf27df4d Fix "self" param to the GS.leave callback 2013-04-11 23:44:17 -03:00
Matthias Richter
615dd8f111 Fix gamestate:init() bug, and error on undefined callbacks 2013-02-25 18:46:04 +01:00
Matthias Richter
8d4e5bb65f Update license header 2013-02-20 16:54:57 +01:00
Matthias Richter
5b1b67b23e Deprecate gamestate constructor 2013-02-20 15:51:50 +01:00
Matthias Richter
f080a9c14a [Gamestate] Remove __index metamethod for new gamestates (world of pain) 2013-01-27 11:43:39 +01:00
Matthias Richter
d22749990d Allow arbitraty gamestate callbacks 2013-01-26 12:56:59 +01:00
Matthias Richter
914ee08202 Return GS callback result (for love.quit(), etc) 2012-10-06 09:46:36 +02:00
Matthias Richter
adcceed73b Update license header 2012-04-10 17:00:02 +02:00
Matthias Richter
99ece87eb6 Metatable magic in gamestate 2011-11-19 20:41:43 +01:00
Matthias Richter
c8440e2bc0 Fix issue #2: mousepressed doesn't work in gamestate.lua (thanks, benloran!) 2011-09-08 14:26:02 +02:00
Matthias Richter
28b698fb00 Eliminate use of module(...) function 2011-07-06 14:19:31 +02:00
Matthias Richter
e885ec90d4 Add gamestate:init() 2011-03-15 17:34:28 +01:00
Matthias Richter
ec3cfcab53 Apply nevon's patch: More gamestate callbacks 2011-01-22 11:53:31 +01:00
Matthias Richter
9bcb428555 Make proper tail recursion calls 2011-01-19 16:41:59 +01:00
Matthias Richter
d1d6dbb056 Make proper modules 2011-01-18 17:44:38 +01:00
Matthias Richter
902437d562 Throw error in case of missing argument instead of silently failing 2010-11-16 16:26:33 +01:00
Matthias Richter
6b2f1f4caa Add missing callbacks, make ignorant of passed arguments, bug in Gamestate.keypressed 2010-10-31 13:04:08 +01:00
Matthias Richter
8311ddbad1 Add license header 2010-09-19 15:37:55 +02:00
Matthias Richter
6315155955 Bug: prevent from switching to initial gamestate 2010-08-13 15:36:12 +02:00
Matthias Richter
da90605de9 Add error-producing initial gamestate 2010-08-13 14:48:24 +02:00
Matthias Richter
f491a92eaa Initial commit 2010-08-09 17:52:48 +02:00