// category GameWindow var GameWindow = { // GameWindow.width
The game window's width. Cannot be changed. width: 0, // GameWindow.height
The game window's height. Cannot be changed. height: 0, // GameWindow.backgroundColor
Background color. Contains an r, g and b component (0-255). backgroundColor: { r: 255, g: 255, b: 255 }, windowElement: null, elementID: "GameBuilder_Window", init: function(x, y, width, height) { GameWindow.width = width; GameWindow.height = height; var body = document.body; body.insertAdjacentHTML('beforeend', ''); //$("body").append('
'); GameWindow.windowElement = document.getElementById(GameWindow.elementID); // GameWindow.canvas

The game's canvas element GameWindow.canvas = document.getElementById(GameWindow.elementID); // GameWindow.canvasContext

The game's canvasContext. Use this for drawing. GameWindow.canvasContext = GameWindow.canvas.getContext('2d'); console.log("GAME: Window initialized: [" + width + ", " + height + "]"); }, redraw: function() { this.canvasContext.fillStyle = "rgb(" + this.backgroundColor.r + "," + this.backgroundColor.g + "," + this.backgroundColor.b + ")"; // sets the color to fill in the rectangle with this.canvasContext.fillRect(0, 0, this.width, this.height); for(var i = 0; i < Game.activeObjects.length; i++) { if(Game.activeObjects[i].active && Game.activeObjects[i].renderer.visible) Game.activeObjects[i].g_draw(GameWindow.canvasContext); } } }