oakmound / oak

A pure Go game engine
Apache License 2.0
1.55k stars 83 forks source link

scene.Scene should interpret nil values as noops. #125

Closed lolbinarycat closed 4 years ago

lolbinarycat commented 4 years ago

Sometimes you might have a scene that's logic is entirely governed by bound events, and doesn't need the loop field. Or maybe you don't need startup code (yet).

Currently, in these cases you still would have to type out the function and it's type signature (which can be fairly long, especially in start and end). What I think we should do, is have a simple nil check in oak.AddScene. If any of the fields are nil, replace it with it's noop function.

The main question is what to do for scene.Loop, as it is unclear whether the default behavior should be to go to the next scene immediately, or stay on the current scene forever. There are also a few other options: