Game Objects module includes factories now

This commit is contained in:
Richard Davey 2017-09-14 01:53:47 +01:00
parent 229af2dffd
commit 651a6b3fac
2 changed files with 24 additions and 1 deletions

View file

@ -16,17 +16,38 @@ var GameObjects = {
Text: require('./text/static/Text'), Text: require('./text/static/Text'),
Tilemap: require('./tilemap/dynamic/Tilemap'), Tilemap: require('./tilemap/dynamic/Tilemap'),
TileSprite: require('./tilesprite/TileSprite'), TileSprite: require('./tilesprite/TileSprite'),
Zone: require('./zone/Zone') Zone: require('./zone/Zone'),
// Game Object Factories
BlitterFactory: require('./blitter/BlitterFactory'),
DynamicBitmapTextFactory: require('./bitmaptext/dynamic/DynamicBitmapTextFactory'),
DynamicTilemapFactory: require('./tilemap/dynamic/TilemapFactory'),
GraphicsFactory: require('./graphics/GraphicsFactory'),
GroupFactory: require('./group/GroupFactory'),
ImageFactory: require('./image/ImageFactory'),
SpriteFactory: require('./sprite/SpriteFactory'),
StaticBitmapTextFactory: require('./bitmaptext/static/BitmapTextFactory'),
StaticTilemapFactory: require('./tilemap/static/StaticTilemapFactory'),
TextFactory: require('./text/static/TextFactory'),
TileSpriteFactory: require('./tilesprite/TileSpriteFactory'),
ZoneFactory: require('./zone/ZoneFactory'),
}; };
if (WEBGL_RENDERER) if (WEBGL_RENDERER)
{ {
// WebGL only Game Objects
GameObjects.EffectLayer = require('./effectlayer/EffectLayer'); GameObjects.EffectLayer = require('./effectlayer/EffectLayer');
GameObjects.LightLayer = require('./lightlayer/LightLayer'); GameObjects.LightLayer = require('./lightlayer/LightLayer');
GameObjects.Mesh = require('./mesh/Mesh'); GameObjects.Mesh = require('./mesh/Mesh');
GameObjects.Quad = require('./quad/Quad'); GameObjects.Quad = require('./quad/Quad');
GameObjects.RenderPass = require('./renderpass/RenderPass.js'); GameObjects.RenderPass = require('./renderpass/RenderPass.js');
GameObjects.EffectLayerFactory = require('./effectlayer/EffectLayerFactory');
GameObjects.LightLayerFactory = require('./lightlayer/LightLayerFactory');
GameObjects.MeshFactory = require('./mesh/MeshFactory');
GameObjects.QuadFactory = require('./quad/QuadFactory');
GameObjects.RenderPassFactory = require('./renderpass/RenderPassFactory');
} }
module.exports = GameObjects; module.exports = GameObjects;

View file

@ -46,6 +46,8 @@ var GameObjectFactory = new Class({
GameObjectFactory.register = function (type, factoryFunction) GameObjectFactory.register = function (type, factoryFunction)
{ {
// console.log('register', type);
if (!GameObjectFactory.prototype.hasOwnProperty(type)) if (!GameObjectFactory.prototype.hasOwnProperty(type))
{ {
GameObjectFactory.prototype[type] = factoryFunction; GameObjectFactory.prototype[type] = factoryFunction;