The Screen handles all aspects of interacting with the screen for Excalibur.

Hierarchy

  • Screen

Constructors

Properties

graphicsContext: ExcaliburGraphicsContext

Accessors

  • get antialiasing(): boolean
  • Returns boolean

  • set antialiasing(isSmooth: boolean): void
  • Parameters

    • isSmooth: boolean

    Returns void

  • get aspectRatio(): number
  • Returns number

  • get canvas(): HTMLCanvasElement
  • Returns HTMLCanvasElement

  • get canvasHeight(): number
  • The height of the game canvas in pixels, (physical height component of the resolution of the canvas element)

    Returns number

  • get canvasWidth(): number
  • The width of the game canvas in pixels (physical width component of the resolution of the canvas element)

    Returns number

  • get center(): Vector
  • Returns screen center coordinates including zoom and device pixel ratio.

    Returns Vector

  • get drawHeight(): number
  • Returns the height of the engine's visible drawing surface in pixels including zoom and device pixel ratio.

    Returns number

  • get drawWidth(): number
  • Returns the width of the engine's visible drawing surface in pixels including zoom and device pixel ratio.

    Returns number

  • get halfCanvasHeight(): number
  • Returns half height of the game canvas in pixels (half physical height component)

    Returns number

  • get halfCanvasWidth(): number
  • Returns half width of the game canvas in pixels (half physical width component)

    Returns number

  • get halfDrawHeight(): number
  • Returns half the height of the engine's visible drawing surface in pixels including zoom and device pixel ratio.

    Returns number

  • get halfDrawWidth(): number
  • Returns half the width of the engine's visible drawing surface in pixels including zoom and device pixel ratio.

    Returns number

  • get isFullScreen(): boolean
  • Returns true if excalibur is fullscreen using the browser fullscreen api

    Returns boolean

  • get parent(): HTMLElement | Window
  • Returns HTMLElement | Window

  • get pixelRatio(): number
  • Returns number

  • get scaledHeight(): number
  • Returns number

  • get scaledWidth(): number
  • Returns number

Methods

  • Returns void

  • Requests to exit fullscreen using the browser fullscreen api

    Returns Promise<void>

  • Returns a BoundingBox of the top left corner of the screen and the bottom right corner of the screen.

    World bounds are in world coordinates, useful for culling objects offscreen

    Returns BoundingBox

  • Requests to go fullscreen using the browser fullscreen api, requires user interaction to be successful. For example, wire this to a user click handler.

    Optionally specify a target element id to go fullscreen, by default the game canvas is used

    Parameters

    • Optional elementId: string

    Returns Promise<void>

  • Takes a coordinate in normal html page space, for example from a pointer move event, and translates it to Excalibur screen space.

    Excalibur screen space starts at the top left (0, 0) corner of the viewport, and extends to the bottom right corner (resolutionX, resolutionY)

    Parameters

    Returns Vector

  • Returns void

  • Returns void

  • Takes a coordinate in Excalibur screen space, and translates it to normal html page space. For example, this is where html elements might live if you want to position them relative to Excalibur.

    Excalibur screen space starts at the top left (0, 0) corner of the viewport, and extends to the bottom right corner (resolutionX, resolutionY)

    Parameters

    Returns Vector

  • Takes a coordinate in Excalibur screen space, and translates it to Excalibur world space.

    World space is where entities in Excalibur live by default CoordPlane.World and extends infinitely out relative from the Camera.

    Parameters

    • point: Vector

      Screen coordinate to convert

    Returns Vector