GraphicsComponent
Hierarchy
- Component
- GraphicsComponent
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
Parameters
optionaloptions: GraphicsComponentOptions
Returns GraphicsComponent
Properties
publiccopyGraphics
If set to true graphics added to the component will be copied. This can effect performance, but is useful if you don't want changes to a graphic to effect all the places it is used.
optionalreadonlydependencies
Optionally list any component types this component depends on If the owner entity does not have these components, new components will be added to the entity
Only components with zero-arg constructors are supported as automatic component dependencies
publicflipHorizontal
Flip all graphics horizontally along the y-axis
publicflipVertical
Flip all graphics vertically along the x-axis
publicmaterial
publiconPostDraw
Draws after the entity transform has been applied, and after graphics component graphics has been drawn
Type declaration
Draws after the entity transform has been applied, and after graphics component graphics has been drawn
Parameters
ctx: ExcaliburGraphicsContext
elapsedMilliseconds: number
Returns void
publiconPostTransformDraw
Draws after the entity transform has been applied, and after all graphics component drawing
Type declaration
Draws after the entity transform has been applied, and after all graphics component drawing
Parameters
ctx: ExcaliburGraphicsContext
elapsedMilliseconds: number
Returns void
publiconPreDraw
Draws after the entity transform has been applied, but before graphics component graphics have been drawn
Type declaration
Draws after the entity transform has been applied, but before graphics component graphics have been drawn
Parameters
ctx: ExcaliburGraphicsContext
elapsedMilliseconds: number
Returns void
publiconPreTransformDraw
Draws before the entity transform has been applied before any any graphics component drawing
Type declaration
Draws before the entity transform has been applied before any any graphics component drawing
Parameters
ctx: ExcaliburGraphicsContext
elapsedMilliseconds: number
Returns void
publicopacity
Sets or gets wither all drawings should have an opacity applied
optionalowner
Current owning [[Entity]], if any, of this component. Null if not added to any [[Entity]]
publicvisible
Sets or gets wether any drawing should be visible in this component
Accessors
publicanchor
publicbounds
Get world bounds of graphics component
Returns BoundingBox
publiccurrent
Returns the currently displayed graphic
Returns Graphic
publiccurrentOptions
Returns the currently displayed graphic offsets
Returns GraphicsShowOptions
publicgraphics
Returns all graphics associated with this component
Returns {}
[graphicName string]: Graphic
publiclocalBounds
Get local bounds of graphics component
Returns BoundingBox
Parameters
bounds: BoundingBox
Returns void
publicoffset
publicoptions
Returns all graphics options associated with this component
Returns {}
[graphicName string]: GraphicsShowOptions
Methods
publicadd
Adds a named graphic to this component, if the name is "default" or not specified, it will be shown by default without needing to call
Parameters
graphic: Graphic
optionaloptions: GraphicsShowOptions
Returns Graphic
publicclone
Clones any properties on this component, if that property value has a
clone()
method it will be calledReturns GraphicsComponent
publicgetGraphic
Parameters
name: string
Returns Graphic
publicgetNames
Get registered graphics names
Returns string[]
publicgetOptions
Parameters
name: string
Returns GraphicsShowOptions
publichide
Hide currently shown graphic
Returns void
optionalonAdd
Optional callback called when a component is added to an entity
Parameters
owner: Entity<any>
Returns void
optionalonRemove
Optional callback called when a component is removed from an entity
Parameters
previousOwner: Entity<any>
Returns void
publicrecalculateBounds
Returns void
publicremove
Removes a registered graphic, if the removed graphic is the current it will switch to the default
Parameters
name: string
Returns void
publicshow
Shows a graphic, will be removed
Type parameters
Parameters
nameOrGraphic: string | T
optionaloptions: GraphicsShowOptions
Returns T
publicuse
Use a graphic only, will set the default graphic. Returns the new [[Graphic]]
Optionally override the stored options
Type parameters
Parameters
nameOrGraphic: string | T
optionaloptions: GraphicsShowOptions
Returns T
Component to manage drawings, using with the position component