Class SceneCallback
- Direct Known Subclasses:
GLFWRenderModuleRenderer
A module does not register these directly. It registers a generator with
MainModuleEngine.registerSceneCallbackGenerator(Function), and the engine applies that generator
to every scene, so a module that wants to act on scenes gets one callback per scene without
having to track scenes itself.
The engine calls init() once, then loop() at the configured frame rate, and
clean() on shutdown, all on its single callback thread.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanWhether this callback has finished setting itself up.protected final MainModuleEngineThe engine this callback belongs to.protected final SceneThe scene this callback acts on. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSceneCallback(MainModuleEngine mainModuleEngine, Scene scene) Creates a callback bound to the given engine and scene. -
Method Summary
Modifier and TypeMethodDescriptionabstract voidclean()Releases whatever this callback acquired ininit().abstract voidinit()Sets this callback up against its scene.booleanReturns whether this callback has finished setting itself up.abstract voidloop()Advances this callback by one frame.
-
Field Details
-
mainModuleEngine
The engine this callback belongs to. -
scene
The scene this callback acts on. -
initialized
protected boolean initializedWhether this callback has finished setting itself up.Deliberately not maintained by this class. An implementation sets this to
truefrom its owninit(), at the point where its setup is genuinely complete — only the implementation knows when that is.
-
-
Constructor Details
-
SceneCallback
Creates a callback bound to the given engine and scene.- Parameters:
mainModuleEngine- the engine this callback belongs toscene- the scene this callback acts on
-
-
Method Details
-
isInitialized
public boolean isInitialized()Returns whether this callback has finished setting itself up.- Returns:
trueonce the implementation has flagged its own setup complete
-
init
public abstract void init()Sets this callback up against its scene.Called once, before the first
loop(). An implementation should setinitializedwhen it finishes. -
loop
public abstract void loop()Advances this callback by one frame.Called repeatedly at the frame rate the engine's configuration specifies.
-
clean
public abstract void clean()Releases whatever this callback acquired ininit().
-