gma.levelParser

Creates Gamma objects and associated render helpers from a level specification

Package gma/utils/parser

Properties

templates

Holds Render template objects to be assigned to entities
Could say something like
banana = [‘colladaTemplate’,
{
collada : {
document : ‘banana.gae’
},
yRot : 1.57,
yOffset : -0.5,
yScale : 0.7
}
],
or have entries that are already an instantiated templateHelper
Type Object
Default {} with “cube” and “redcube”

types

Associates names to gamma objects/render helpers
It
Type Object
Default {default : [‘platform’, {template : “cube”}]}

Methods

processLevel (level) -> Processed specification

Processes a level specification and replaces it’s content with gamma objects

Parameters
level Object The level specification
preProcess (level)

Ensures the level has the minimum amount specified

Parameters
level Object The level specification
processPosition (obj)

Creates locX, locY and locZ keys from items in position array.

Parameters
obj Object Object potentially containing a position array
processAttached (key, value, level)

Remove attached from value and given to level.following

Parameters
key string The key that will be used to reference the attached data
value object The specification that may have an ‘attached’ property
level Level Specification The level that we are attaching information to
determineTemplate (manager, templateSpec)

Gets a template Helper from a spec

Parameters
manager gma.manager  
templateSpec String Name of the template
validate_other (manager, key, value, level) -> Boolean
Validates other stuff
For the moment, nothing happens
Parameters
manager gma.manager  
key String The key of the parent object this value belongs to
value Object The value object being validated
level Level Specification The level currently being parsed
process_other (manager, key, value, level) -> Boolean
Processes other stuff
For the moment, nothing happens
Parameters
manager gma.manager  
key String The key of the parent object this value belongs to
value Object The value object being processed
level Level Specification The level currently being parsed
default_spawn ( )
Returns default value for the spawn object
validate_spawn (manager, key, value, level) -> Boolean
Validates a spawn object
Spawn must be an object of {id : [x, y]}
Parameters
manager gma.manager  
key String The key of the parent object this value belongs to
value Object The value object being validated
level Level Specification The level currently being parsed
process_spawn (manager, key, value, level) -> Boolean
Processes a spawn object
Must ensure each position array has two numbers in it
Parameters
manager gma.manager  
key String The key of the parent object this value belongs to
value Object The value object being processed
level Level Specification The level currently being parsed
default_camera ( )
Returns default value for the camera object
validate_camera (manager, key, value, level) -> Boolean
Validates a camera specification
Camera must be an object
Parameters
manager gma.manager  
key String The key of the parent object this value belongs to
value Object The value object being validated
level Level Specification The level currently being parsed
process_camera (manager, key, value, level) -> Boolean
Processes a camera specification
Turn position in locX, locY and locZ
Remove attached from value and given to level.following
Parameters
manager gma.manager  
key String The key of the parent object this value belongs to
value Object The value object being processed
level Level Specification The level currently being parsed
default_light ( )
Returns default value for the light object
validate_light (manager, key, value, level) -> Boolean
Validates a light object
Light must be an array
Parameters
manager gma.manager  
key String The key of the parent object this value belongs to
value Object The value object being validated
level Level Specification The level currently being parsed
process_light (manager, key, value, level) -> Boolean
Processes a light object
Turn position in locX, locY and locZ
Remove attached from level and given to level.following
Parameters
manager gma.manager  
key String The key of the parent object this value belongs to
value Object The value object being processed
level Level Specification The level currently being parsed
default_entities ( )
Returns default value for the entities list
validate_entities (manager, key, value, level) -> Boolean
Validates an entities list
Entities must be an array
Parameters
manager gma.manager  
key String The key of the parent object this value belongs to
value Object The value object being validated
level Level Specification The level currently being parsed
process_entities (manager, key, value, level) -> Boolean
Processes a entities list
Turns them into gamma objects
Parameters
manager gma.manager  
key String The key of the parent object this value belongs to
value Object The value object being processed
level Level Specification The level currently being parsed
validate_background (manager, key, value, level) -> Boolean

Validates a background list

Parameters
manager gma.manager  
key String The key of the parent object this value belongs to
value Object The value object being validated
level Level Specification The level currently being parsed
process_background (manager, key, value, level) -> Boolean
Processes a background list
Just adds to self.background
Parameters
manager gma.manager  
key String The key of the parent object this value belongs to
value Object The value object being processed
level Level Specification The level currently being parsed
validate_types (manager, key, value, level) -> Boolean

Validates a types object

Parameters
manager gma.manager  
key String The key of the parent object this value belongs to
value Object The value object being validated
level Level Specification The level currently being parsed
process_types (manager, key, value, level) -> Boolean
Processes a types object
Just adds to self.types
Parameters
manager gma.manager  
key String The key of the parent object this value belongs to
value Object The value object being processed
level Level Specification The level currently being parsed
validate_templates (manager, key, value, level) -> Boolean

Validates a templates object

Parameters
manager gma.manager  
key String The key of the parent object this value belongs to
value Object The value object being validated
level Level Specification The level currently being parsed
process_templates (manager, key, value, level) -> Boolean
Processes a templates object
Just adds to self.templates
Parameters
manager gma.manager  
key String The key of the parent object this value belongs to
value Object The value object being processed
level Level Specification The level currently being parsed
validate_bkgIds (manager, key, value, level) -> Boolean
Validates bkgIds
This is populated by process_background
Parameters
manager gma.manager  
key String The key of the parent object this value belongs to
value Object The value object being validated
level Level Specification The level currently being parsed
process_bkgIds (manager, key, value, level) -> Boolean
Processes bkgIds
This is populated by process_background
Parameters
manager gma.manager  
key String The key of the parent object this value belongs to
value Object The value object being processed
level Level Specification The level currently being parsed
validate_levelExtras (manager, key, value, level) -> Boolean
Validates level extras specification
This is generated at run time and should be ignored
Parameters
manager gma.manager  
key String The key of the parent object this value belongs to
value Object The value object being validated
level Level Specification The level currently being parsed
process_levelExtras (manager, key, value, level) -> Boolean
Processes level extras stuff
This is generated at run time and should be ignored
Parameters
manager gma.manager  
key String The key of the parent object this value belongs to
value Object The value object being processed
level Level Specification The level currently being parsed
validate_following (manager, key, value, level) -> Boolean
Validates following specification
This is generated at run time and should be ignored
Parameters
manager gma.manager  
key String The key of the parent object this value belongs to
value Object The value object being validated
level Level Specification The level currently being parsed
process_following (manager, key, value, level) -> Boolean
Processes following stuff
This is generated at run time and should be ignored
Parameters
manager gma.manager  
key String The key of the parent object this value belongs to
value Object The value object being processed
level Level Specification The level currently being parsed
validate_removed (manager, key, value, level) -> Boolean
Validates removed stuff
This is generated at run time and should be ignored
Parameters
manager gma.manager  
key String The key of the parent object this value belongs to
value Object The value object being validated
level Level Specification The level currently being parsed
process_removed (manager, key, value, level) -> Boolean
Processes removed stuff
This is generated at run time and should be ignored
Parameters
manager gma.manager  
key String The key of the parent object this value belongs to
value Object The value object being processed
level Level Specification The level currently being parsed
setProperties (obj, opts, avoid)

Sets options on a GLGE object

Package gma/utils/render

Parameters
obj object The object we are setting options on
opts Object The options to set on the object
avoid [String] List of options not to set on object

Table Of Contents

Fork me on GitHub