oakmound / oak

A pure Go game engine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

scene.Scene should interpret nil values as noops.

lolbinarycat opened this issue · comments

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:

  • Don't support this for scene.Loop
  • Loop infinitely if scene.End is nil, and go to the next scene otherwise (my current preference)
  • Add an option for it in oak.SetupConfig (I don't like this).