HTML and CSS Reference
In-Depth Information
Q.activeStage = 0;
Q.stage = function(num) {
// Use activeStage is num is undefined
num = (num === void 0) ? Q.activeStage : num;
return Q.stages[num];
};
Q.stageScene = function(scene,num,stageClass) {
stageClass = stageClass || Q.Stage;
if(_(scene).isString()) {
scene = Q.scene(scene);
}
num = num || 0;
if(Q.stages[num]) {
Q.stages[num].destroy();
}
Q.stages[num] = new stageClass(scene);
if(!Q.loop) {
Q.gameLoop(Q.stageGameLoop);
}
};
Q.stageGameLoop = function(dt) {
if(Q.ctx) { Q.clear(); }
for(var i =0,len=Q.stages.length;i<len;i++) {
Q.activeStage = i;
var stage = Q.stage();
if(stage) {
stage.step(dt);
stage.draw(Q.ctx);
}
}
Q.activeStage = 0;
if(Q.input && Q.ctx) { Q.input.drawCanvas(Q.ctx); }
};
Q.clearStage = function(num) {
if(Q.stages[num]) {
Search WWH ::




Custom Search