Class Index | File Index

Classes


Class Core


Defined in: core.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Core()
Creates an instance of the Core module
Field Summary
Field Attributes Field Name and Description
 
Canvas element height.
 
Canvas element width.
 
ctx
Reference to Canvas.
 
Device name.
 
FPS counter difference in time value.
 
FPS counter draw interval.
 
FPS counter frame counter.
 
FPS counter frames per second value.
 
FPS counter last time value.
 
FPS counter max frames per second counter.
 
FPS counter current time value.
 
Platform type.
Method Summary
Method Attributes Method Name and Description
 
Detect device and store in #deviceName.
 
Detect if we are running on a Desktop or Mobile device and store in #platformType.
 
Calculate the frames per second and store in #framesPerSecond.
 
Increment the frame counter stored in #frameCounter.
 
Return canvas height stored in #canvasHeight.
 
Return canvas width stored in #canvasWidth.
 
Return the drawing interval rate stored in #drawInterval.
 
Return the game frames per second stored in #framesPerSecond.
 
Return the game maximum frames per second stored in #maxFramesPerSecond.
 
getReference(canvas, ctx)
Get reference to Canvas and 2D context.
 
Resize the Canvas frame on window resize.
 
setDrawInterval(interval)
Set the millisecond drawing interval rate, and maximum frames per second based on this value.
 
Set the Canvas frame properties.
Class Detail
Core()
Creates an instance of the Core module
See:
core.js
Field Detail
{Number} canvasHeight
Canvas element height.

{Number} canvasWidth
Canvas element width.

{[object CanvasRenderingContext2D]} ctx
Reference to Canvas.

{String} deviceName
Device name.

{Number} diffTime
FPS counter difference in time value.

{Number} drawInterval
FPS counter draw interval.

{Number} frameCounter
FPS counter frame counter.

{Number} framesPerSecond
FPS counter frames per second value.

{Number} lastTime
FPS counter last time value.

{Number} maxFramesPerSecond
FPS counter max frames per second counter.

{Number} nowTime
FPS counter current time value.

{String} platformType
Platform type.
Method Detail
{String} detectDevice()
Detect device and store in #deviceName.
Returns:
{String} String denoting device type. "Firefox", "Chrome", "Opera", "IE", "Safari", "SafariMobile", "Android", "AndroidMobile" or "Incompatible".

{String} detectPlatform()
Detect if we are running on a Desktop or Mobile device and store in #platformType.
Returns:
{String} Returns String denoting platform: "Desktop" or "Mobile".

fpsCalc()
Calculate the frames per second and store in #framesPerSecond.

fpsInc()
Increment the frame counter stored in #frameCounter.

{Number} getCanvasHeight()
Return canvas height stored in #canvasHeight.
Returns:
{Number} Number denoting height of Canvas.

{Number} getCanvasWidth()
Return canvas width stored in #canvasWidth.
Returns:
{Number} Number denoting width of Canvas.

{Number} getDrawInterval()
Return the drawing interval rate stored in #drawInterval.
Returns:
{Number} Number denoting drawing interval rate.

{Number} getFPS()
Return the game frames per second stored in #framesPerSecond.
Returns:
{Number} Number denoting game frames per second.

{Number} getMaximumFPS()
Return the game maximum frames per second stored in #maxFramesPerSecond.
Returns:
{Number} Number denoting maximum game frames per second.

{[object HTMLCanvasElement|object CanvasRenderingContext2D]} getReference(canvas, ctx)
Get reference to Canvas and 2D context. The first canvas object to be found is taken as the main canvas.
Parameters:
{[object HTMLCanvasElement]} canvas
Canvas object.
{[object CanvasRenderingContext2D]} ctx
2D Canvas Context object.
Returns:
{[object HTMLCanvasElement|object CanvasRenderingContext2D]} canvas and ctx object.

resize()
Resize the Canvas frame on window resize.

setDrawInterval(interval)
Set the millisecond drawing interval rate, and maximum frames per second based on this value.
Parameters:
{Number} interval
The drawing interval value.

setFrameProperties()
Set the Canvas frame properties.

Documentation generated by JsDoc Toolkit 2.4.0 on Fri May 06 2011 14:41:27 GMT+0100 (BST)