Class Index | File Index

Classes


Class com.jiffeegames.Engine

An Engine object is the glue for all the other modules in the game. It takes a list of modules which have been created but not yet plugged-in or initialized, figures out the right order to add them, then plugs in and initializes each one. As it initializes the individual modules, it gives each one a customized service locator that it can use to link to any other modules that it depends on.
Defined in: jiffee-engine.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Create an Engine object.
Method Summary
Method Attributes Method Name and Description
 
add(module)
Add a module to the engine.
 
addStdLibs(lang)
Add all the standard modules to the engine.
 
init(language)
Initialize the engine, and all the modules in it.
 
plugInModule_(module)
Try to plug a module into the engine.
 
 
run(cmd)
 
Class Detail
com.jiffeegames.Engine()
Create an Engine object. A typical use is:
var engine = new com.jiffeegames.Engine();
engine.addStdLibs('en-us');
engine.add(new com.jiffeegames.Module1());
engine.add(new com.jiffeegames.Module2());
engine.init('en-us');
Method Detail
add(module)
Add a module to the engine.
Parameters:
{Module} module
- A newly created but not-yet-initialized module.

addStdLibs(lang)
Add all the standard modules to the engine. This is just a shortcut to save you typing (and to make sure you don't forget any module names) in the normal case where you want to make all the standard modules supplied by JIFFEE available to your game.
Parameters:
lang

init(language)
Initialize the engine, and all the modules in it. This method checks the dependencies of all the modules which have been added, finds a feasible start-up order, then plugs-in and initializes all the modules in that order. Although it is normally called only once, after all the modules have been added, it is also legal to add more modules and then call init() again.
Parameters:
{String} language
The target language, e.g. 'en-us' or 'zh-cn'.

plugInModule_(module)
Try to plug a module into the engine.
Parameters:
{Module} module
- the module to be plugged in.
Returns:
true if it succeeds, false if doesn't.
  • If all this module's dependencies are already plugged-in, plug in this module, initialize it, and return true.
  • If one or more of this module's dependencies are not yet plugged-in, return false.
  • If an error is detected which cannot be resolved by continuing to plug in other modules, throw an error.

reportProblems_()

run(cmd)
Parameters:
cmd

start_()

Documentation generated by JsDoc Toolkit 2.3.2 on Sun Jul 25 2010 13:49:30 GMT-0700 (PDT)