From 648ee61ae84216d0236e0dbc211addc13b2cfa3a Mon Sep 17 00:00:00 2001 From: Kris Kowal Date: Fri, 6 Jul 2012 11:52:06 -0700 Subject: Expand tabs --- js/helper-classes/RDGE/src/core/script/engine.js | 186 +++++++++++------------ 1 file changed, 93 insertions(+), 93 deletions(-) (limited to 'js/helper-classes/RDGE/src/core/script/engine.js') diff --git a/js/helper-classes/RDGE/src/core/script/engine.js b/js/helper-classes/RDGE/src/core/script/engine.js index 36a34689..b2191197 100755 --- a/js/helper-classes/RDGE/src/core/script/engine.js +++ b/js/helper-classes/RDGE/src/core/script/engine.js @@ -31,72 +31,72 @@ POSSIBILITY OF SUCH DAMAGE. var RDGE = RDGE || {}; /* - * Manage state instances + * Manage state instances */ RDGE.stateManager = function () { - // a stack of states - this.stateStack = []; - - // number of states on the stack + // a stack of states + this.stateStack = []; + + // number of states on the stack this.stateTop = undefined; // the states of the context - this.RDGEInitState = null; - this.RDGERunState = null; + this.RDGEInitState = null; + this.RDGERunState = null; this.currentState = function () { - if(this.stateTop != undefined) - return this.stateStack[this.stateTop]; - - return null; + if(this.stateTop != undefined) + return this.stateStack[this.stateTop]; + + return null; }; - - /* - * Push new IRuntime state - engine executes the new state - */ + + /* + * Push new IRuntime state - engine executes the new state + */ this.PushState = function (state, flags) { if (state != null && typeof state.Init == 'function') { - if(this.stateTop != undefined) - this.stateStack[this.stateTop].LeaveState(); - - if(flags == undefined || flags != "noInit") - state.Init(); - - this.stateTop = this.stateStack.push(state) - 1; - } + if(this.stateTop != undefined) + this.stateStack[this.stateTop].LeaveState(); + + if(flags == undefined || flags != "noInit") + state.Init(); + + this.stateTop = this.stateStack.push(state) - 1; + } }; - /* - * Remove IRuntime state from stack, engine executes previous state - */ + /* + * Remove IRuntime state from stack, engine executes previous state + */ this.PopState = function () { - state = this.stateStack.pop(); + state = this.stateStack.pop(); if (state != null) { - state.Shutdown(); - } - - this.stateTop = this.stateTop > 0 ? this.stateTop - 1 : 0; - + state.Shutdown(); + } + + this.stateTop = this.stateTop > 0 ? this.stateTop - 1 : 0; + if (this.stateStack[this.stateTop]) { - this.stateStack[this.stateTop].ReInit(); - } + this.stateStack[this.stateTop].ReInit(); + } }; - /* - * Remove all states from the stack - */ + /* + * Remove all states from the stack + */ this.PopAll = function () { while (this.stateStack[this.stateTop] != null) { - this.PopState(); - } + this.PopState(); + } }; - + this.tick = function (dt) { if (this.stateStack[this.stateTop] != null) { - this.stateStack[this.stateTop].Update(dt); - this.stateStack[this.stateTop].Resize(); - this.stateStack[this.stateTop].Draw(); - } + this.stateStack[this.stateTop].Update(dt); + this.stateStack[this.stateTop].Resize(); + this.stateStack[this.stateTop].Draw(); + } }; }; @@ -124,22 +124,22 @@ RDGE.Engine = function () { this.RDGECanvas = null; /* - * a map of canvas names to renderer + * a map of canvas names to renderer */ this.canvasToRendererMap = {}; /* - * states to canvas map - maps a state stack to the canvas context it belongs to + * states to canvas map - maps a state stack to the canvas context it belongs to */ this.canvasNameToStateStack = {}; /* - * the list of context's that are active + * the list of context's that are active */ this.canvasCtxList = []; /* - * regex object to verify runtime object is not some sort of exploit + * regex object to verify runtime object is not some sort of exploit */ invalidObj = new RegExp("([()]|function)"); @@ -154,7 +154,7 @@ RDGE.Engine = function () { }; /* - * The context definition - every context shares these parameters + * The context definition - every context shares these parameters */ contextDef = function () { this.id = null; @@ -218,7 +218,7 @@ RDGE.Engine = function () { }; /* - * give the contextID (canvas id) of the context to set + * give the contextID (canvas id) of the context to set */ this.setContext = function (contextID) { contextManager.currentCtx = contextManager.contextMap[contextID]; @@ -254,38 +254,38 @@ RDGE.Engine.prototype.init = function (userInitState, userRunState, canvasObject this.GlInit(canvasObject); globalParamFuncSet = function (param) { - this.data = param.data; - this.type =param.type; - + this.data = param.data; + this.type =param.type; + this.set = function (v) { - var len = this.data ? this.data.length : 0; - for(var i=0;i