Graphics Game Object base

This commit is contained in:
Felipe Alfonso 2017-02-28 11:49:39 -03:00
parent 13810cb601
commit c30a95cb01
8 changed files with 78 additions and 3 deletions

View file

@ -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;

View file

@ -0,0 +1,9 @@
var GraphicsCanvasRenderer = function (renderer, src, interpolationPercentage, camera)
{
if (this.renderMask !== this.renderFlags)
{
return;
}
}
module.exports = GraphicsCanvasRenderer;

View file

@ -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);

View file

@ -0,0 +1,6 @@
module.exports = {
renderCanvas: require('./GraphicsCanvasRenderer'),
renderWebGL: require('./GraphicsWebGLRenderer')
};

View file

@ -0,0 +1,9 @@
var GraphicsWebGLRenderer = function (renderer, src, interpolationPercentage, camera)
{
if (this.renderMask !== this.renderFlags)
{
return;
}
}
module.exports = GraphicsWebGLRenderer;

View file

@ -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')
};

View file

@ -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: