API Documentation

for 0.0.1
Show:

Runner Class

A runner is used to instanciate a Mobilizing.js user's script inside a specific context. It is requiered to use a Runner to initiate a context and to attech a script to it.

Constructor

Runner

(
  • mobscriptinstance
  • params
)

Parameters:

  • mobscriptinstance Object

    the Mobilizing.js script instance given by the user

  • params Object

    JSON parameters to activate or not some Mobilizing.js modules when used in an other lib (i.e. CoSiMa)

    • canvas

      canvas used by the engine

    • callback

      a callback function that get called when the user script setup() is finished (function args are the Runner instance and the user script instance)

    • inputEnabled

      enable the Mobilizing Input built-in manager

    • audioEnabled

      enable the Mobilizing Audio manager

Example:

<!DOCTYPE html>
   <html>
       <head>
           <meta http-equiv="Content-Type" content="text/html; charset=utf8">
           <meta charset="UTF-8">
           <meta name="viewport" content="height=device-height,width=device-width" />
           <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no" />
           <meta name="apple-mobile-web-app-capable" content="yes">
           <meta name="apple-touch-fullscreen" content="yes">

           <link rel='stylesheet' href='css/main.css' />

           <script src="../../vendor/three/three.min.js"></script>
           <script src="../../vendor/opentype/opentype.js"></script>
           <script src="../../dist/Mobilizing.js"></script>
           <script src="script.js"></script>
           <script>
               //script.js is a user written script that must be instanciate for the Runner
               var runner = new Mobilizing.Runner(new script());
           </script>
       </head>
   <body>
   </body>
 </html>
function script()
{
   this.setup = function(){
   //get the current context to work with
       var context = this.getContext();
   };

   this.update = function(){

   };
 };

Methods

loop

() private

Runner's requestAnimationFrame loop manager

onFrameBegin

()

onFrameBegin

onFrameEnd

()

onFrameEnd

run

() private

Runs the runner, init the context, create the preLoader and launch it, then execute the script

startLoop

() private

Starts the loop of the user's script, that is the update function