A single scene's callbacks. More...
#include <scene.h>
Public Attributes | |
| void(* | init )(void) |
| Called once when the scene is first pushed onto the stack. | |
| void(* | update )(void) |
| Called every VBlank while the scene is on top of the stack. | |
A single scene's callbacks.
Field stability: this struct is part of the public API. New fields may be added at the END only — designated initialisers stay compatible. Position-based initialisation is therefore discouraged.
Called once when the scene is first pushed onto the stack.
NOT called again when the scene is resumed after a pop. May be NULL to skip. A common shape is to load tilesets / palettes / configure backgrounds in init so the work happens in force blank or before setScreenOn.
Called every VBlank while the scene is on top of the stack.
MUST NOT be NULL. The framework does NOT defend against this: if update is NULL, the dispatcher will JSL to whatever lives at address $00:0000 (SNES register hardware page) and crash immediately. The check is omitted on purpose — a fast crash is more diagnosable than a silent skip would be, and the per-frame cost of the check is non-zero on a 1.79 MHz CPU.
The caller may invoke scenePush or scenePop from inside update; the change takes effect on the next VBlank dispatch.