mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 13:13:43 +00:00
Static Tilemap Base
This commit is contained in:
parent
4b68b5b5a3
commit
c470df9db5
5 changed files with 87 additions and 0 deletions
42
v3/src/gameobjects/tilemap/static/StaticTilemap.js
Normal file
42
v3/src/gameobjects/tilemap/static/StaticTilemap.js
Normal 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;
|
|
@ -0,0 +1,9 @@
|
|||
var StaticTilemapCanvasRenderer = function (renderer, src, interpolationPercentage, camera)
|
||||
{
|
||||
if (this.renderMask !== this.renderFlags)
|
||||
{
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = StaticTilemapCanvasRenderer;
|
21
v3/src/gameobjects/tilemap/static/StaticTilemapFactory.js
Normal file
21
v3/src/gameobjects/tilemap/static/StaticTilemapFactory.js
Normal 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);
|
6
v3/src/gameobjects/tilemap/static/StaticTilemapRender.js
Normal file
6
v3/src/gameobjects/tilemap/static/StaticTilemapRender.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
module.exports = {
|
||||
|
||||
renderCanvas: require('./StaticTilemapCanvasRenderer'),
|
||||
renderWebGL: require('./StaticTilemapTextWebGLRenderer')
|
||||
|
||||
};
|
|
@ -0,0 +1,9 @@
|
|||
var StaticTilemapWebGLRenderer = function (renderer, src, interpolationPercentage, camera)
|
||||
{
|
||||
if (this.renderMask !== this.renderFlags)
|
||||
{
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = StaticTilemapWebGLRenderer;
|
Loading…
Reference in a new issue