Class: CanvasBuffer

CanvasBuffer

CanvasBuffer provide a simple middle ware to instantiate buffers
What is it: Buffers are a good way to improve performances in your games
1- Canvas offscreen manipulation is faster than Canvas in the dom (draw, resize, etc..)
2- sometimes you don't need to render all things you got in your game
Example: in a RPG game, you render the tiled floor only once in a buffer, then you render only this buffer.
Try the two ways you'll see performances improved (of course not on a very small map)
!!Warning!! Buffers can become very slow and heavy if you bufferise something very very big (more than 2000 pixels)
In a future version I'll optimise auto-cut buffering to provide the best way to bufferise big stuff without DIY, but right now, be careful.

Declare buffers only with Integers, never declare with 0, negative or float

new CanvasBuffer(width, height)

Parameters:
Name Type Description
width Int
height Int
Source:
Example
 var customBuffer = new DE.CanvasBuffer( 500, 250 );

Methods

<static> this.clear() → {CanvasBuffer}

clear the buffer

Source:
Returns:

this current instance

Type
CanvasBuffer

<static> this.resize(newWidth, newHeight) → {CanvasBuffer}

resize the buffer

Parameters:
Name Type Description
newWidth Int
newHeight Int
Source:
Returns:

this current instance

Type
CanvasBuffer
Dreamirl Copyright © 2014 And the contributors
Documentation generated by JSDoc 3.2.2 on Thu Apr 24 2014 11:56:40 GMT+0200 (CEST) using the DocStrap template.