mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 18:47:35 +00:00
moved files towards new structure. fixes #22
This commit is contained in:
parent
8cf8f057bb
commit
9de3147406
40 changed files with 0 additions and 110 deletions
53
app/game/Client/View/DomController.js
Executable file
53
app/game/Client/View/DomController.js
Executable file
|
|
@ -0,0 +1,53 @@
|
|||
define(['Chuck/Settings'], function(Settings) {
|
||||
|
||||
var Dom = {
|
||||
canvas: null,
|
||||
debugCanvas: null
|
||||
};
|
||||
|
||||
Dom.getCanvasContainer = function(){
|
||||
var container = document.getElementById(Settings.CANVAS_DOM_ID);
|
||||
|
||||
if(container) {
|
||||
return container;
|
||||
} else {
|
||||
throw 'Canvas Container missing: #' + Settings.CANVAS_DOM_ID;
|
||||
}
|
||||
}
|
||||
|
||||
Dom.getCanvas = function(){
|
||||
return Dom.canvas;
|
||||
}
|
||||
|
||||
Dom.setCanvas = function(canvas){
|
||||
|
||||
var container = Dom.getCanvasContainer();
|
||||
if(Dom.canvas){
|
||||
container.removeChild(Dom.canvas);
|
||||
}
|
||||
|
||||
Dom.canvas = canvas;
|
||||
container.appendChild(canvas);
|
||||
}
|
||||
|
||||
Dom.getDebugCanvas = function(){
|
||||
return Dom.debugCanvas;
|
||||
}
|
||||
|
||||
Dom.createDebugCanvas = function(){
|
||||
|
||||
var container = Dom.getCanvasContainer();
|
||||
if(Dom.debugCanvas){
|
||||
container.removeChild(Dom.debugCanvas);
|
||||
}
|
||||
|
||||
var canvas = document.createElement('canvas');
|
||||
canvas.width = Settings.STAGE_WIDTH;
|
||||
canvas.height = Settings.STAGE_HEIGHT;
|
||||
Dom.debugCanvas = canvas;
|
||||
container.appendChild(canvas);
|
||||
}
|
||||
|
||||
return Dom;
|
||||
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue