Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • ExcaliburGraphicsContextWebGL

Implements

Index

Constructors

Properties

__gl: WebGL2RenderingContext

Meant for internal use only. Access the internal context at your own risk and no guarantees this will exist in the future.

internal
backgroundColor: Color = Color.ExcaliburBlue

Set the background color of the graphics context, default is Color.ExcaliburBlue

debug: ExcaliburGraphicsContextWebGLDebug = ...

Access the debug drawing api

smoothing: boolean = false

Enable smoothed drawing (also known as anti-aliasing), by default false

snapToPixel: boolean = false

Snaps all drawings to the nearest pixel truncated down, by default false

useDrawSorting: boolean = true

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

Accessors

  • get height(): number
  • get opacity(): number
  • set opacity(value: number): void
  • get width(): number
  • get z(): number
  • set z(value: number): void

Methods

  • beginDrawLifecycle(): void
  • clear(): void
  • clearPostProcessors(): void
  • draw<TRenderer>(rendererName: TRenderer["type"], ...args: Parameters<TRenderer["draw"]>): void
  • drawCircle(pos: Vector, radius: number, color: Color, stroke?: Color, thickness?: number): void
  • drawImage(image: HTMLImageSource, x: number, y: number): void
  • drawImage(image: HTMLImageSource, x: number, y: number, width: number, height: number): void
  • drawImage(image: HTMLImageSource, sx: number, sy: number, swidth?: number, sheight?: number, dx?: number, dy?: number, dwidth?: number, dheight?: number): void
  • drawRectangle(pos: Vector, width: number, height: number, color: Color, stroke?: Color, strokeThickness?: number): void
  • endDrawLifecycle(): void
  • flush(): void
  • get(rendererName: string): RendererPlugin
  • register<T>(renderer: T): void
  • resetTransform(): void
  • restore(): void
  • rotate(angle: number): void
  • save(): void
  • scale(x: number, y: number): void
  • translate(x: number, y: number): void