App
class is the root instance of any ceramic app.
Events
update(delta:Float):Void
Fired as many times as there are frames per seconds. It is in sync with screen FPS but used for everything that needs to get updated depending on time (ceramic.Timer relies on it). Use this event to update your contents before they get drawn again.
Parameters:
delta | The elapsed delta time since last frame |
---|
preUpdate(delta:Float):Void
Fired right before update event and can be used when you want to run garantee your code will be run before regular update event.
Parameters:
delta | The elapsed delta time since last frame |
---|
postUpdate(delta:Float):Void
Fired right after update event and can be used when you want to run garantee your code will be run after regular update event.
Parameters:
delta | The elapsed delta time since last frame |
---|
defaultAssetsLoad(assets:Assets):Void
Fired right before default assets are being loaded.
Parameters:
assets | The |
---|
criticalError(error:Dynamic, stack:Array<StackItem>):Void
Fired when the app hits an critical (uncaught) error. Can be used to perform custom crash reporting. If this even is handled, app exit should be performed by the event handler.
Parameters:
error | The error |
---|---|
stack | The stack trace of the error |
beginSortVisuals():Void
Fired right before sorting all visuals. Visual are sorted at each frame depending on their properties: depth, texture, blending, shader...
Static variables
Variables
read onlycomputedFps:Int
Computed fps of the app. Read only. Value is automatically computed from last second of frame updates.
read onlyrealDelta:Float
Current frame real delta time (the actual elapsed time since last frame update)
read onlyvisuals:Array<Visual> = []
Visuals (ordered) Active list of visuals being managed by ceramic. This list is ordered and updated at every frame. In between, it could contain destroyed visuals as they are removed only at the end of the frame for performance reasons.
read onlypendingVisuals:Array<Visual> = []
Pending visuals: visuals that have been created this frame
but were not added to the visual
list yet
read onlydestroyedVisuals:Array<Visual> = []
Pending destroyed visuals: visuals that have been destroyed this frame
but were not removed to the visual
list yet
read onlyassets:Assets
App level assets. Used to load default assets (font, texture, shader) required to make ceramic work properly.
read onlydefaultTexturedShader:Shader = null
Default textured shader. This is the shader used for any visual (quad or mesh) that don't have a custom shader assigned.
read onlydefaultWhiteTexture:Texture = null
Default white texture. When a quad or mesh doesn't have a texture assigned, it will use the default white texture instead to render as plain flat coloured object. This means that the same default shader is used and everything can be batched together (textured & non-textured in the same batch).
read onlypersistent:PersistentData = null
App level persistent data.
This is a simple key-value store ready to be used.
Don't forget to call persistent.save()
to apply changes permanently.
read onlytextInput:TextInput = null
Shared text input manager. Usually not used directly as is.
You might want to use EditText
component instead.
converters:Map<String, ConvertField<Dynamic, Dynamic>> = new Map()
Converters are used to transform field data in Fragment
instances.
This map is matching a type (as string, like "Array<Float>"
) with an instance
of a ConvertField
subclass.
Methods
inlineonceImmediate(owner:Entity, handleImmediate:() ‑> Void):Void
inlineonceImmediate(handleImmediate:() ‑> Void):Void
Schedule immediate callback that is garanteed to be executed before the next time frame (before elements are drawn onto screen)
Parameters:
owner | Owner of this callback, allowing to cancel callback if owner is destroyed |
---|---|
handleImmediate | The callback to execute |
inlineoncePostFlushImmediate(owner:Entity, handlePostFlushImmediate:() ‑> Void, defer:Bool = true):Void
inlineoncePostFlushImmediate(handlePostFlushImmediate:() ‑> Void, defer:Bool = true):Void
Schedule callback that is garanteed to be executed when no immediate callback are pending anymore.
Parameters:
owner | Owner of this callback, allowing to cancel callback if owner is destroyed |
---|---|
handlePostFlushImmediate | The callback to execute |
defer | if |
flushImmediate():Bool
Execute and flush every awaiting immediate callback, including the ones that
could have been added with onceImmediate()
after executing the existing callbacks.
Returns:
true
if anything was flushed