Class MainCallback
java.lang.Object
io.codetoil.curved_spacetime.MainCallback
- Direct Known Subclasses:
VulkanModuleVulkan
Work the engine runs once at start-up and then repeatedly, independent of any scene.
A module registers one of these with
MainModuleEngine.registerMainCallback(MainCallback). The engine calls init()
once, then loop() at the configured frame rate, and clean() on shutdown. All
three run on the engine's single callback thread, so an implementation may hold mutable state
without synchronising it against the other callbacks.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanWhether this callback has finished setting itself up.protected final MainModuleEngineThe engine this callback belongs to. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedMainCallback(MainModuleEngine mainModuleEngine) Creates a callback bound to the given engine. -
Method Summary
-
Field Details
-
mainModuleEngine
The engine this callback belongs to. -
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
-
MainCallback
Creates a callback bound to the given engine.- Parameters:
mainModuleEngine- the engine this callback belongs to
-
-
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.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().
-