Interface: canvas

MC.canvas


The canvas object contains references to and records properties of the canvas associated with the MaxCanvas engine at Initialisation
Properties are automatically updated as required.
Properties:
Name Type Description
canvas Object Reference to the canvas associated with this instance of the MaxCanvas engine.
Defined at initialisation
width Number Width of the full canvas (in pixels)
height Number Height of the full canvas (in pixels)
midX Number X coordinate of the canvas middle (in pixels)
midY Number Y coordinate of the canvas middle (in pixels)
top Number Top of the canvas after "bounds" have been applied (in pixels)
bottom Number Bottom of the canvas after "bounds" have been applied (in pixels)
left Number Left of the canvas after "bounds" have been applied (in pixels)
right Number Right of the canvas after "bounds" have been applied (in pixels)
fullWindow Boolean true if the Canvas is set to size to the window (and resize with it)
Source:

Methods

(static) log()


Console logs the canvas properties
Source:

(static) setBounds()


Sets the canvas.top, bottom, left and right properties to reflect game.bounds and canvas dimensions
CAUTION. This is intended for Engine internal use. Developers should use game.setBounds() to safely change a canvas's bounds
Source:

(static) setSize(newWidth, newHeight)


Sets the canvas element's to a new width and height
All canvas properties (including bounds) are automatically reset
Parameters:
Name Type Description
newWidth Number New canvas width (in pixels)
newHeight Number New canvas height (in pixels)
Source:

(static) windowResize()


Handles window re-size
CAUTION. This is intended for Engine internal use and is called automatically if required.
Source: