1 /**
  2  * The Render Engine
  3  * Engine initialization
  4  *
  5  * @author: Brett Fattori (brettf@renderengine.com)
  6  * @author: $Author: bfattori $
  7  * @version: $Revision: 1555 $
  8  *
  9  * Copyright (c) 2011 Brett Fattori (brettf@renderengine.com)
 10  *
 11  * Permission is hereby granted, free of charge, to any person obtaining a copy
 12  * of this software and associated documentation files (the "Software"), to deal
 13  * in the Software without restriction, including without limitation the rights
 14  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 15  * copies of the Software, and to permit persons to whom the Software is
 16  * furnished to do so, subject to the following conditions:
 17  *
 18  * The above copyright notice and this permission notice shall be included in
 19  * all copies or substantial portions of the Software.
 20  *
 21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 22  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 23  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 24  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 25  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 26  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 27  * THE SOFTWARE.
 28  *
 29  */
 30 
 31 // Start the console so logging can take place immediately
 32 R.debug.Console.startup();
 33 
 34 // Default engine options
 35 R.Engine.defaultOptions = {
 36     "skipFrames":true, // Skip frames which cannot be rendered without impacting framerate
 37     "billboards":true, // Use billboards to speed up rendering
 38     "textUseBillboards":true, // Text will use billboards unless platform doesn't support it
 39     "hardwareAccel":false, // Hardware acceleration supported flag (deprecated)
 40     "pointAsArc":true, // Draw points as arcs or rectangles (dot or rect)
 41     "transientMathObject":false, // Transient (non-pooled) MathObjects
 42     "useDirtyRectangles":false, // Enable canvas dirty rectangles redraws
 43     "nativeAnimationFrame":true, // Enable the use of "requestAnimationFrame"
 44     "disableParticleEngine":false, // Disable particle engines (if used)
 45     "maxParticles":250, // Default maximum particles engine will allow
 46     "useVirtualControlPad":false, // Show the virtual d-pad (for touch)
 47     "virtualPad":{                                          // Virtual d-pad mappings
 48         "up":"R.engine.Events.KEYCODE_UP_ARROW",
 49         "down":"R.engine.Events.KEYCODE_DOWN_ARROW",
 50         "left":"R.engine.Events.KEYCODE_LEFT_ARROW",
 51         "right":"R.engine.Events.KEYCODE_RIGHT_ARROW"
 52     },
 53     "virtualButtons":{                                      // Virtual control button mappings
 54         "A":"A",
 55         "B":"B",
 56         "C":"C"
 57     }
 58 };
 59 
 60 
 61 // Configure the default options
 62 R.Engine.options = $.extend({}, R.Engine.defaultOptions);
 63 
 64 // Set up the engine using whatever query params were passed
 65 R.Engine.setDebugMode(R.engine.Support.checkBooleanParam("debug"));
 66 
 67 if (R.Engine.getDebugMode()) {
 68     R.debug.Console.setDebugLevel(R.engine.Support.getNumericParam("debugLevel", R.debug.Console.DEBUGLEVEL_DEBUG));
 69 }
 70 
 71 // Local mode keeps loaded script source available
 72 R.Engine.localMode = R.engine.Support.checkBooleanParam("local");
 73