From c470df9db507c95553b5f438e86aea1faeac621f Mon Sep 17 00:00:00 2001 From: Felipe Alfonso Date: Tue, 30 May 2017 12:55:15 -0400 Subject: [PATCH] Static Tilemap Base --- .../tilemap/static/StaticTilemap.js | 42 +++++++++++++++++++ .../static/StaticTilemapCanvasRenderer.js | 9 ++++ .../tilemap/static/StaticTilemapFactory.js | 21 ++++++++++ .../tilemap/static/StaticTilemapRender.js | 6 +++ .../static/StaticTilemapWebGLRenderer.js | 9 ++++ 5 files changed, 87 insertions(+) create mode 100644 v3/src/gameobjects/tilemap/static/StaticTilemap.js create mode 100644 v3/src/gameobjects/tilemap/static/StaticTilemapCanvasRenderer.js create mode 100644 v3/src/gameobjects/tilemap/static/StaticTilemapFactory.js create mode 100644 v3/src/gameobjects/tilemap/static/StaticTilemapRender.js create mode 100644 v3/src/gameobjects/tilemap/static/StaticTilemapWebGLRenderer.js diff --git a/v3/src/gameobjects/tilemap/static/StaticTilemap.js b/v3/src/gameobjects/tilemap/static/StaticTilemap.js new file mode 100644 index 000000000..5e7ad69f3 --- /dev/null +++ b/v3/src/gameobjects/tilemap/static/StaticTilemap.js @@ -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; diff --git a/v3/src/gameobjects/tilemap/static/StaticTilemapCanvasRenderer.js b/v3/src/gameobjects/tilemap/static/StaticTilemapCanvasRenderer.js new file mode 100644 index 000000000..831b55ad4 --- /dev/null +++ b/v3/src/gameobjects/tilemap/static/StaticTilemapCanvasRenderer.js @@ -0,0 +1,9 @@ +var StaticTilemapCanvasRenderer = function (renderer, src, interpolationPercentage, camera) +{ + if (this.renderMask !== this.renderFlags) + { + return; + } +}; + +module.exports = StaticTilemapCanvasRenderer; diff --git a/v3/src/gameobjects/tilemap/static/StaticTilemapFactory.js b/v3/src/gameobjects/tilemap/static/StaticTilemapFactory.js new file mode 100644 index 000000000..b2b4a1c19 --- /dev/null +++ b/v3/src/gameobjects/tilemap/static/StaticTilemapFactory.js @@ -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); diff --git a/v3/src/gameobjects/tilemap/static/StaticTilemapRender.js b/v3/src/gameobjects/tilemap/static/StaticTilemapRender.js new file mode 100644 index 000000000..70afa0a42 --- /dev/null +++ b/v3/src/gameobjects/tilemap/static/StaticTilemapRender.js @@ -0,0 +1,6 @@ +module.exports = { + + renderCanvas: require('./StaticTilemapCanvasRenderer'), + renderWebGL: require('./StaticTilemapTextWebGLRenderer') + +}; diff --git a/v3/src/gameobjects/tilemap/static/StaticTilemapWebGLRenderer.js b/v3/src/gameobjects/tilemap/static/StaticTilemapWebGLRenderer.js new file mode 100644 index 000000000..e3ff11e00 --- /dev/null +++ b/v3/src/gameobjects/tilemap/static/StaticTilemapWebGLRenderer.js @@ -0,0 +1,9 @@ +var StaticTilemapWebGLRenderer = function (renderer, src, interpolationPercentage, camera) +{ + if (this.renderMask !== this.renderFlags) + { + return; + } +}; + +module.exports = StaticTilemapWebGLRenderer;