ExcaliburGraphicsContextWebGL
Implements
Index
Constructors
Properties
Accessors
Methods
- addPostProcessor
- beginDrawLifecycle
- checkIfResolutionSupported
- clear
- clearPostProcessors
- createMaterial
- createShader
- dispose
- draw
- drawCircle
- drawImage
- drawLine
- drawRectangle
- endDrawLifecycle
- flush
- get
- getTransform
- multiply
- register
- removePostProcessor
- resetTransform
- restore
- rotate
- save
- scale
- transform
- translate
- updatePostProcessors
- updateViewport
Constructors
constructor
Parameters
options: ExcaliburGraphicsContextWebGLOptions
Returns ExcaliburGraphicsContextWebGL
Properties
publicbackgroundColor
debug
Access the debug drawing api
publicmaterialScreenTexture
publicreadonlymultiSampleAntialiasing
publicreadonlypixelArtSampler
Whether the pixel art sampler is enabled for smooth sub pixel anti-aliasing
publicoptionalreadonlysamples
publicreadonlysmoothing
Native context smoothing
publicsnapToPixel
Snaps the drawing x/y coordinate to the nearest whole pixel
publictextureLoader
publicreadonlytransparency
publicuseDrawSorting
Excalibur will automatically sort draw calls by z and priority for maximal draw performance, this can disrupt a specific desired painter order.
To force a specific draw call order, use [[ExcaliburGraphicsContext.z]]
By default useDrawSorting
is true
, to opt out set this to false
publicuvPadding
UV padding in pixels to use in internal image rendering to prevent texture bleed
Accessors
publicheight
Returns number
publicmaterial
Gets or sets the material to be used in the current context's drawings
This allows customs shaders to be used but draw calls are no longer batched by default.
Returns Material
Gets or sets the material to be used in the current context's drawings
This allows customs shaders to be used but draw calls are no longer batched by default.
Parameters
material: Material
Returns void
publicopacity
Sets the opacity of the current [[Graphic]] being drawn, default is 1
Returns number
Sets the opacity of the current [[Graphic]] being drawn, default is 1
Parameters
value: number
Returns void
publicortho
Returns Matrix
publictint
publicwidth
Returns number
publicz
Set the current z context for the graphics context. Draw calls issued to the context will use this z to inform their sort order.
Note it is important to all [[ExcaliburGraphicsContext.save]] and [[ExcaliburGraphicsContext.restore]] when modifying state.
Returns number
Set the current z context for the graphics context. Draw calls issued to the context will use this z to inform their sort order.
Note it is important to all [[ExcaliburGraphicsContext.save]] and [[ExcaliburGraphicsContext.restore]] when modifying state.
Parameters
value: number
Returns void
Methods
publicaddPostProcessor
Add a post processor to the graphics context
Post processors are run in the order they were added.
Parameters
postprocessor: PostProcessor
Returns void
publicbeginDrawLifecycle
Returns void
publiccheckIfResolutionSupported
Checks the underlying webgl implementation if the requested internal resolution is supported
Parameters
dim: ScreenDimension
Returns boolean
clear
Clears the screen with the current background color
Returns void
publicclearPostProcessors
Remove all post processors from the graphics context
Returns void
publiccreateMaterial
Creates and initializes the material which compiles the internal shader
Parameters
options: Omit<MaterialOptions, graphicsContext>
Returns Material
Material
publiccreateShader
Parameters
options: Omit<ShaderOptions, gl>
Returns Shader
publicdispose
Returns void
publicdraw
Type parameters
- TRenderer: RendererPlugin
Parameters
rendererName: TRenderer[type]
rest...args: Parameters<TRenderer[draw]>
Returns void
publicdrawCircle
drawImage
Draw an image to the Excalibur Graphics context at an x and y coordinate using the images width and height
Parameters
image: HTMLImageSource
x: number
y: number
Returns void
publicdrawLine
publicdrawRectangle
publicendDrawLifecycle
Returns void
flush
Flushes all batched rendering to the screen
Returns void
publicget
Parameters
rendererName: string
Returns RendererPlugin
publicgetTransform
Gets the current transform
Returns AffineMatrix
publicmultiply
Multiplies the current transform by a matrix
Parameters
m: AffineMatrix
Returns void
publicregister
Type parameters
- T: RendererPlugin
Parameters
renderer: T
Returns void
publicremovePostProcessor
Remove a specific post processor from the graphics context
Parameters
postprocessor: PostProcessor
Returns void
publicresetTransform
Resets the current transform to the identity matrix
Returns void
publicrestore
Restore the state of the canvas from the stack
Returns void
publicrotate
Rotate the context about the current origin
Parameters
angle: number
Returns void
publicsave
Save the current state of the canvas to the stack (transforms and opacity)
Returns void
publicscale
Scale the context by an x and y factor
Parameters
x: number
y: number
Returns void
publictransform
Parameters
matrix: AffineMatrix
Returns void
publictranslate
Translate the origin of the context by an x and y
Parameters
x: number
y: number
Returns void
publicupdatePostProcessors
Parameters
delta: number
Returns void
publicupdateViewport
Update the context with the current viewport dimensions (used in resizing)
Parameters
resolution: ScreenDimension
Returns void
Set the background color of the graphics context, default is [[Color.ExcaliburBlue]]