Renderer

Module: engine.renderer.core

Canvas renderer. Instance automatically created at game.renderer

new game.Renderer(width, height)

Parameters:

  • width Number
  • height Number

Properties

_smoothProperty String

(No description yet)

canvas HTMLCanvasElement

(No description yet)

context CanvasRenderingContext2D

(No description yet)

Methods

_clear()

Clear canvas.

_hide()

Hide canvas.

_initContext()

(No description yet)

_position(x, y)

Set canvas position with CSS.

Parameters:

  • x Number
  • y Number
_render(container)

Render container to canvas.

Parameters:

  • container Container
_resize(width, height)

Resize canvas.

Parameters:

  • width Number
  • height Number
_show()

Show canvas.

_size(width, height)

Set canvas size with CSS.

Parameters:

  • width Number
  • height Number

Attributes

clearBeforeRender Boolean (Default: true)

Clear canvas on start of every frame.

roundPixels Boolean (Default: false)

Use round positions.

scaleMode String (Default: linear)

Set scaleMode to nearest to disable smoothing (great for scaled pixel art).