DefaultLoader
Hierarchy
- DefaultLoader
Implements
Index
Constructors
constructor
Parameters
optionaloptions: DefaultLoaderOptions
Optionally provide the list of resources you want to load at constructor time
Returns DefaultLoader
Properties
publiccanvas
publicdata
Data associated with a loadable
publicengine
publicevents
Accessors
publicprogress
Returns the progress of the loader as a number between [0, 1] inclusive.
Returns number
publicresources
Returns readonly Loadable<any>[]
Methods
publicaddResource
Add a resource to the loader to load
Parameters
loadable: Loadable<any>
Resource to add
Returns void
publicaddResources
Add a list of resources to the loader to load
Parameters
loadables: Loadable<any>[]
The list of resources to load
Returns void
publicareResourcesLoaded
Returns Promise<void>
publicemit
Type parameters
- TEventName: EventKey<LoaderEvents>
Parameters
eventName: TEventName
event: LoaderEvents[TEventName]
Returns void
publicisLoaded
Returns true if the loader has completely loaded all resources
Returns boolean
publicload
Not meant to be overridden
Begin loading all of the supplied resources, returning a promise that resolves when loading of all is complete AND the user has interacted with the loading screen
Returns Promise<Loadable<any>[]>
publicmarkResourceComplete
Returns void
publicoff
Type parameters
- TEventName: EventKey<LoaderEvents>
Parameters
eventName: TEventName
handler: Handler<LoaderEvents[TEventName]>
Returns void
publicon
Type parameters
- TEventName: EventKey<LoaderEvents>
Parameters
eventName: TEventName
handler: Handler<LoaderEvents[TEventName]>
Returns Subscription
publiconAfterLoad
Overridable lifecycle method, called after loading has completed
Returns Promise<void>
publiconBeforeLoad
Overridable lifecycle method, called directly before loading starts
Returns Promise<void>
onDraw
Optionally override the onDraw
Parameters
ctx: CanvasRenderingContext2D
Returns void
publiconInitialize
Called by the engine before loading
Parameters
engine: Engine<any>
Returns void
onUpdate
Optionally override the onUpdate
Parameters
engine: Engine<any>
elapsedMilliseconds: number
Returns void
publiconUserAction
Return a promise that resolves when the user interacts with the loading screen in some way, usually a click.
It's important to implement this in order to unlock the audio context in the browser. Browsers automatically prevent audio from playing until the user performs an action.
Returns Promise<void>
publiconce
Type parameters
- TEventName: EventKey<LoaderEvents>
Parameters
eventName: TEventName
handler: Handler<LoaderEvents[TEventName]>
Returns Subscription
An interface describing loadable resources in Excalibur. Built-in loadable resources include Texture, Sound, and a generic Resource.