Canvas

BGE. Canvas

Contains a roku roBitmap which all game objects get drawn to.

Constructor

new Canvas(canvasWidth, canvasHeight) → {void}

Creates a Canvas object and bitmap

Parameters:
Name Type Description
canvasWidth integer

width of canvas

canvasHeight integer

height of canvas

Properties:
Name Type Description
bitmap object

bitmap GameEntity images get drawn to

offset_x float

horizontal position offset from screen coordinates

offset_y float

vertical position offset from screen coordinates

scale_x float

horizontal scale

scale_y float

vertical scale

Source:

Methods

getHeight() → {integer}

Gets the height of the underlying bitmap

Source:

getOffset() → {object}

Gets the offset of the canvas from the screen

Source:

getScale() → {object}

Gets the scale of the canvas

Source:

getWidth() → {integer}

Gets the width of the underlying bitmap

Source:

setOffset(x, y) → {void}

Sets the offset of the canvase. This is as Float to allow incrementing by less than 1 pixel, it is converted to integer internally

Parameters:
Name Type Description
x float

x offset

y float

y offset

Source:

setScale(scale_x, scale_yopt) → {void}

Sets the scale of the canvas

Parameters:
Name Type Attributes Default Description
scale_x float

horizontal scale

scale_y dynamic <optional>
invalid

vertical scale, or if invalid, use the horizontal scale as vertical scale

Source:

setSize(canvasWidth, canvasHeight) → {void}

Changes the size of the canvas

Parameters:
Name Type Description
canvasWidth integer

width of canvas

canvasHeight integer

height of canvas

Source: