aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/RDGE/src/core/script/runtime.js
diff options
context:
space:
mode:
authorKris Kowal2012-07-06 12:34:53 -0700
committerKris Kowal2012-07-06 15:01:48 -0700
commit3644cb6def4f681c99959e5729e78ea353441fad (patch)
treef8a886f4829e507cc4956db37cff2580cae6003d /js/helper-classes/RDGE/src/core/script/runtime.js
parent04343eda8c2f870b0da55cfdc8003c99fe1cc4de (diff)
downloadninja-3644cb6def4f681c99959e5729e78ea353441fad.tar.gz
Normalize to unix line terminators
Diffstat (limited to 'js/helper-classes/RDGE/src/core/script/runtime.js')
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/runtime.js446
1 files changed, 223 insertions, 223 deletions
diff --git a/js/helper-classes/RDGE/src/core/script/runtime.js b/js/helper-classes/RDGE/src/core/script/runtime.js
index e671ece7..5e6203fb 100755
--- a/js/helper-classes/RDGE/src/core/script/runtime.js
+++ b/js/helper-classes/RDGE/src/core/script/runtime.js
@@ -1,223 +1,223 @@
1/* <copyright> 1/* <copyright>
2Copyright (c) 2012, Motorola Mobility, Inc 2Copyright (c) 2012, Motorola Mobility, Inc
3All Rights Reserved. 3All Rights Reserved.
4BSD License. 4BSD License.
5 5
6Redistribution and use in source and binary forms, with or without 6Redistribution and use in source and binary forms, with or without
7modification, are permitted provided that the following conditions are met: 7modification, are permitted provided that the following conditions are met:
8 8
9 - Redistributions of source code must retain the above copyright notice, 9 - Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer. 10 this list of conditions and the following disclaimer.
11 - Redistributions in binary form must reproduce the above copyright 11 - Redistributions in binary form must reproduce the above copyright
12 notice, this list of conditions and the following disclaimer in the 12 notice, this list of conditions and the following disclaimer in the
13 documentation and/or other materials provided with the distribution. 13 documentation and/or other materials provided with the distribution.
14 - Neither the name of Motorola Mobility nor the names of its contributors 14 - Neither the name of Motorola Mobility nor the names of its contributors
15 may be used to endorse or promote products derived from this software 15 may be used to endorse or promote products derived from this software
16 without specific prior written permission. 16 without specific prior written permission.
17 17
18THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28POSSIBILITY OF SUCH DAMAGE. 28POSSIBILITY OF SUCH DAMAGE.
29</copyright> */ 29</copyright> */
30 30
31// RDGE namespaces 31// RDGE namespaces
32var RDGE = RDGE || {}; 32var RDGE = RDGE || {};
33RDGE.core = RDGE.core || {}; 33RDGE.core = RDGE.core || {};
34RDGE.utilities = RDGE.utilities || {}; 34RDGE.utilities = RDGE.utilities || {};
35 35
36// runtime globals 36// runtime globals
37RDGE.globals = (function () { 37RDGE.globals = (function () {
38 return { 38 return {
39 engine: new RDGE.Engine(), 39 engine: new RDGE.Engine(),
40 width: 0, 40 width: 0,
41 height: 0, 41 height: 0,
42 cam: null, 42 cam: null,
43 shaderMan: null, 43 shaderMan: null,
44 meshMan: null, 44 meshMan: null,
45 poolList: [], 45 poolList: [],
46 gl: null 46 gl: null
47 }; 47 };
48})(); 48})();
49 49
50// new code is above 50// new code is above
51/***************************************************************************************************************/ 51/***************************************************************************************************************/
52 52
53/* 53/*
54 * RDGEState a RDGEstate is an interface that is defined by the user and called by the engine 54 * RDGEState a RDGEstate is an interface that is defined by the user and called by the engine
55 */ 55 */
56RDGE.core.RDGEState = function RDGEState() { }; 56RDGE.core.RDGEState = function RDGEState() { };
57RDGE.core.RDGEState.prototype.init = function () { }; 57RDGE.core.RDGEState.prototype.init = function () { };
58RDGE.core.RDGEState.prototype.update = function () { }; 58RDGE.core.RDGEState.prototype.update = function () { };
59RDGE.core.RDGEState.prototype.draw = function () { }; 59RDGE.core.RDGEState.prototype.draw = function () { };
60RDGE.core.RDGEState.prototype.resize = function () { }; 60RDGE.core.RDGEState.prototype.resize = function () { };
61RDGE.core.RDGEState.prototype.shutdown = function () { }; 61RDGE.core.RDGEState.prototype.shutdown = function () { };
62RDGE.core.RDGEState.prototype.onComplete = function () { }; 62RDGE.core.RDGEState.prototype.onComplete = function () { };
63 63
64/* 64/*
65 * Calling this makes sure the passed in run state has all the functions 65 * Calling this makes sure the passed in run state has all the functions
66 * that are required, adding dummy functions where needed 66 * that are required, adding dummy functions where needed
67 */ 67 */
68RDGE.utilities.validateUserState = function (userState) { 68RDGE.utilities.validateUserState = function (userState) {
69 if (!userState.init) { 69 if (!userState.init) {
70 userState.init = function () { }; 70 userState.init = function () { };
71 } 71 }
72 if (!userState.update) { 72 if (!userState.update) {
73 userState.update = function (dt) { 73 userState.update = function (dt) {
74 var currentScene = RDGE.globals.engine.getContext().currentScene; 74 var currentScene = RDGE.globals.engine.getContext().currentScene;
75 currentScene = RDGE.globals.engine.getScene(currentScene); 75 currentScene = RDGE.globals.engine.getScene(currentScene);
76 76
77 if (currentScene != null) 77 if (currentScene != null)
78 currentScene.update(dt); 78 currentScene.update(dt);
79 } 79 }
80 } 80 }
81 if (!userState.draw) { 81 if (!userState.draw) {
82 userState.draw = function () { 82 userState.draw = function () {
83 var currentScene = RDGE.globals.engine.getContext().currentScene; 83 var currentScene = RDGE.globals.engine.getContext().currentScene;
84 currentScene = RDGE.globals.engine.getScene(currentScene); 84 currentScene = RDGE.globals.engine.getScene(currentScene);
85 85
86 if (currentScene == null) 86 if (currentScene == null)
87 return; 87 return;
88 88
89 currentScene.render(); 89 currentScene.render();
90 } 90 }
91 } 91 }
92 if (!userState.resize) { 92 if (!userState.resize) {
93 userState.resize = function () { }; 93 userState.resize = function () { };
94 } 94 }
95 if (!userState.shutdown) { 95 if (!userState.shutdown) {
96 userState.shutdown = function () { }; 96 userState.shutdown = function () { };
97 } 97 }
98 if (!userState.onComplete) { 98 if (!userState.onComplete) {
99 userState.onComplete = function () { }; 99 userState.onComplete = function () { };
100 } 100 }
101}; 101};
102 102
103/* 103/*
104 * Used to start the RDGE engine, pass the initState and runState, both of which are RDGEState objects 104 * Used to start the RDGE engine, pass the initState and runState, both of which are RDGEState objects
105 * initState is used to asynchronously load scene data while allowing you to render and update if needed 105 * initState is used to asynchronously load scene data while allowing you to render and update if needed
106 * runState is used clear the execution path for regular rendering and updating once loading is complete 106 * runState is used clear the execution path for regular rendering and updating once loading is complete
107 * @param initState - the initialization state, false if you don't want to use one 107 * @param initState - the initialization state, false if you don't want to use one
108 * @param runState - the run state 108 * @param runState - the run state
109 */ 109 */
110RDGE.RDGEStart = function (canvasOrID) { 110RDGE.RDGEStart = function (canvasOrID) {
111 var canvas = canvasOrID; 111 var canvas = canvasOrID;
112 112
113 if (typeof (canvasOrID) === "string") 113 if (typeof (canvasOrID) === "string")
114 canvas = document.getElementById(canvasOrID); 114 canvas = document.getElementById(canvasOrID);
115 115
116 if (!canvas) 116 if (!canvas)
117 return; 117 return;
118 118
119 RDGE.globals.engine.registerCanvas(canvas); 119 RDGE.globals.engine.registerCanvas(canvas);
120 120
121 if (!canvas.task) 121 if (!canvas.task)
122 { 122 {
123 //canvas.task = new RDGE.RDGETask(canvas, true); 123 //canvas.task = new RDGE.RDGETask(canvas, true);
124 canvas.task = new RDGE.RDGETask(canvas, false); 124 canvas.task = new RDGE.RDGETask(canvas, false);
125 } 125 }
126 <