Class Index | File Index

Classes


Class Punx.Grid

Represents the game engine. Houses the main loop and canvas DOM node reference.
Defined in: punx.dist.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Punx.Grid(args)
Field Summary
Field Attributes Field Name and Description
<private>  
Viewport canvas DOM element.
<private>  
Imaginary canvas DOM element used as a frame-buffer for collision detection and other graphics analysis.
<private>  
The game loop, an interval that calls update() on the current screen, timed according to fps.
 
ctx
Viewport canvas context.
 
fps
Integer frames-per-second.
 
Internal frame counter, increments once after every update cycle, wraps at fps.
 
h
Integer canvas height.
 
Imaginary canvas context.
 
For debugging, causes the main loop to idle when true.
 
Required: Key of the initial screen.
 
Required: Object holding all screens, keyed by name.
 
w
Integer canvas width.
Method Summary
Method Attributes Method Name and Description
<private>  
The main loop calls this once every fps.
 
create(parentElement)
Creates the canvases and injects the main canvas into the viewport.
 
Starts the main loop.
Class Detail
Punx.Grid(args)
Parameters:
{object} args
Public field construction values.
Field Detail
<private> _canvas
Viewport canvas DOM element. This is displayed.

<private> _icanvas
Imaginary canvas DOM element used as a frame-buffer for collision detection and other graphics analysis. Scratch-space. Never shown.

<private> _loop
The game loop, an interval that calls update() on the current screen, timed according to fps.

ctx
Viewport canvas context.

{number} fps
Integer frames-per-second.
Default Value:
60

{number} frame
Internal frame counter, increments once after every update cycle, wraps at fps. This should be treated as read-only.
Default Value:
0

{number} h
Integer canvas height.
Default Value:
540

ictx
Imaginary canvas context.

{boolean} idle
For debugging, causes the main loop to idle when true.
Default Value:
false

{string} screen
Required: Key of the initial screen.

{object} screens
Required: Object holding all screens, keyed by name.

{number} w
Integer canvas width.
Default Value:
960
Method Detail
<private> _update()
The main loop calls this once every fps. The loop is killed if any errors occur. Does nothing if idle is true.

create(parentElement)
Creates the canvases and injects the main canvas into the viewport.
Parameters:
parentElement Optional, Default: document.body
DOM element to make the canvas a child of.

start()
Starts the main loop.

Documentation generated by JsDoc Toolkit 2.4.0 on Thu Oct 03 2013 12:33:00 GMT-0700 (PDT)