True layer and buffer support (not stub)

This commit is contained in:
Michael Jumper
2011-02-12 14:07:12 -08:00
parent 3d3aad76c9
commit 0ad9127a68
2 changed files with 70 additions and 22 deletions

View File

@@ -21,16 +21,27 @@ function Layer(width, height) {
// Off-screen buffer
var display = document.createElement("canvas");
display.style.position = "absolute";
display.style.left = "0px";
display.style.right = "0px";
display.width = width;
display.height = height;
var displayContext = display.getContext("2d");
function resize(newWidth, newHeight) {
display.style.position = "absolute";
display.style.left = "0px";
display.style.right = "0px";
display.width = newWidth;
display.height = newHeight;
width = newWidth;
height = newHeight;
}
display.resize = function(newWidth, newHeight) {
if (newWidth != width || newHeight != height)
resize(newWidth, newHeight);
}
resize(width, height);
var readyHandler = null;
var nextUpdateToDraw = 0;
var currentUpdate = 0;