Static Tilemap Base

This commit is contained in:
Felipe Alfonso 2017-05-30 12:55:15 -04:00
parent 4b68b5b5a3
commit c470df9db5
5 changed files with 87 additions and 0 deletions

View file

@ -0,0 +1,42 @@
var Class = require('../../utils/Class');
var GameObject = require('../GameObject');
var Components = require('../../components');
var StaticTilemapRender = require('./StaticTilemapRender');
var TileSprite = new Class({
Extends: GameObject,
Mixins: [
Components.Alpha,
Components.BlendMode,
Components.Flip,
Components.GetBounds,
Components.Origin,
Components.RenderTarget,
Components.ScaleMode,
Components.Size,
Components.Texture,
Components.Transform,
Components.Visible,
StaticTilemapRender
],
initialize:
function StaticTilemap (state, mapData, x, y, width, height, texture, frame)
{
GameObject.call(this, state, 'StaticTilemap');
this.mapData = mapData;
this.setTexture(texture, frame);
this.setPosition(x, y);
this.setSizeToFrame();
this.setOrigin();
this.setSize(width, height);
}
});
module.exports = StaticTilemap;

View file

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

View file

@ -0,0 +1,21 @@
var StaticTilemap = require('./StaticTilemap');
var FactoryContainer = require('../../gameobjects/FactoryContainer');
var StaticTilemapFactory = {
KEY: 'staticTilemap',
add: function (mapData, x, y, width, height, key, frame)
{
return this.children.add(new StaticTilemap(this.state, mapData, x, y, width, height, key, frame));
},
make: function (mapData, x, y, width, height, key, frame)
{
return new StaticTilemap(this.state, mapData, x, y, width, height, key, frame);
}
};
module.exports = FactoryContainer.register(StaticTilemapFactory);

View file

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

View file

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