diff --git a/v3/src/gameobjects/graphics/Graphics.js b/v3/src/gameobjects/graphics/Graphics.js new file mode 100644 index 000000000..852876ffa --- /dev/null +++ b/v3/src/gameobjects/graphics/Graphics.js @@ -0,0 +1,27 @@ +var Class = require('../../utils/Class'); +var GameObject = require('../GameObject'); +var Components = require('../../components'); +var Render = require('./GraphicsRender'); + +var Graphics = new Class({ + + Mixins: [ + Components.Alpha, + Components.BlendMode, + Components.Transform, + Components.Visible, + Render + ], + + initialize: + + function Graphics (state, x, y) + { + GameObject.call(this, state); + + this.setPosition(x, y); + } + +}); + +module.exports = Graphics; diff --git a/v3/src/gameobjects/graphics/GraphicsCanvasRenderer.js b/v3/src/gameobjects/graphics/GraphicsCanvasRenderer.js new file mode 100644 index 000000000..9c89e2b5a --- /dev/null +++ b/v3/src/gameobjects/graphics/GraphicsCanvasRenderer.js @@ -0,0 +1,9 @@ +var GraphicsCanvasRenderer = function (renderer, src, interpolationPercentage, camera) +{ + if (this.renderMask !== this.renderFlags) + { + return; + } +} + +module.exports = GraphicsCanvasRenderer; diff --git a/v3/src/gameobjects/graphics/GraphicsFactory.js b/v3/src/gameobjects/graphics/GraphicsFactory.js new file mode 100644 index 000000000..3ad482af6 --- /dev/null +++ b/v3/src/gameobjects/graphics/GraphicsFactory.js @@ -0,0 +1,22 @@ +var Graphics = require('./Graphics'); +var FactoryContainer = require('../../gameobjects/FactoryContainer'); + +var GraphicsFactory = { + + KEY: 'graphics', + + add: function (x, y, group) + { + if (group === undefined) { group = this.state; } + + return group.children.add(new Graphics(this.state, x, y)); + }, + + make: function (x, y) + { + return new Graphics(this.state, x, y); + } + +}; + +module.exports = FactoryContainer.register(GraphicsFactory); diff --git a/v3/src/gameobjects/graphics/GraphicsRender.js b/v3/src/gameobjects/graphics/GraphicsRender.js new file mode 100644 index 000000000..62c141748 --- /dev/null +++ b/v3/src/gameobjects/graphics/GraphicsRender.js @@ -0,0 +1,6 @@ +module.exports = { + + renderCanvas: require('./GraphicsCanvasRenderer'), + renderWebGL: require('./GraphicsWebGLRenderer') + +}; diff --git a/v3/src/gameobjects/graphics/GraphicsWebGLRenderer.js b/v3/src/gameobjects/graphics/GraphicsWebGLRenderer.js new file mode 100644 index 000000000..767d61cde --- /dev/null +++ b/v3/src/gameobjects/graphics/GraphicsWebGLRenderer.js @@ -0,0 +1,9 @@ +var GraphicsWebGLRenderer = function (renderer, src, interpolationPercentage, camera) +{ + if (this.renderMask !== this.renderFlags) + { + return; + } +} + +module.exports = GraphicsWebGLRenderer; diff --git a/v3/src/gameobjects/index.js b/v3/src/gameobjects/index.js index cd61717b5..2d1c99365 100644 --- a/v3/src/gameobjects/index.js +++ b/v3/src/gameobjects/index.js @@ -6,6 +6,7 @@ require('./container/ContainerFactory'); require('./image/ImageFactory'); require('./sprite/SpriteFactory'); require('./text/BitmapTextFactory'); +require('./graphics/GraphicsFactory'); // Phaser.GameObjects @@ -17,6 +18,7 @@ module.exports = { Blitter: require('./blitter/Blitter'), Container: require('./container/Container'), Image: require('./image/Image'), - Sprite: require('./sprite/Sprite') + Sprite: require('./sprite/Sprite'), + Graphics: require('./graphics/Graphics.js') }; diff --git a/v3/src/gameobjects/text/BitmapText.js b/v3/src/gameobjects/text/BitmapText.js index 8e8d093c9..5ba1fe431 100644 --- a/v3/src/gameobjects/text/BitmapText.js +++ b/v3/src/gameobjects/text/BitmapText.js @@ -1,7 +1,7 @@ var Class = require('../../utils/Class'); var GameObject = require('../GameObject'); var Components = require('../../components'); -var Renderer = require('./BitmapTextRenderer'); +var Render = require('./BitmapTextRender'); var ParseXMLBitmapFont = function (xml, xSpacing, ySpacing, frame) { @@ -58,7 +58,7 @@ var BitmapText = new Class({ Components.Alpha, Components.BlendMode, Components.Visible, - Renderer + Render ], initialize: diff --git a/v3/src/gameobjects/text/BitmapTextRenderer.js b/v3/src/gameobjects/text/BitmapTextRender.js similarity index 100% rename from v3/src/gameobjects/text/BitmapTextRenderer.js rename to v3/src/gameobjects/text/BitmapTextRender.js