mirror of
https://github.com/photonstorm/phaser
synced 2024-11-26 06:30:38 +00:00
Phaser.Tileset has a new property lastgid
which is populated automatically by the TilemapParser when importing Tiled map data, or can be set manually if building your own tileset.
This commit is contained in:
parent
91e7b2ca9c
commit
9eff79f2c2
4 changed files with 32 additions and 9 deletions
|
@ -325,6 +325,7 @@ You can read all about the philosophy behind Lazer [here](http://phaser.io/news/
|
|||
* Group.align now returns `true` if the Group was aligned, or `false` if not.
|
||||
* The Loader.headers object has a new property `requestedWith`. By default this is set to `false`, but it can be used to set the `X-Requested-With` header to `XMLHttpRequest` (or any other value you need). To enable this do `this.load.headers.requestedWith = 'XMLHttpRequest'` before adding anything to the Loader.
|
||||
* ScaleManager.hasPhaserSetFullScreen is a new boolean that identifies if the browser is in full screen mode or not, and if Phaser was the one that requested it. As it's possible to enter full screen mode outside of Phaser, and it then gets confused about what bounding parent to use.
|
||||
* Phaser.Tileset has a new property `lastgid` which is populated automatically by the TilemapParser when importing Tiled map data, or can be set manually if building your own tileset.
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
|
|
|
@ -353,14 +353,17 @@ Phaser.TilemapParser = {
|
|||
if (gid > 0)
|
||||
{
|
||||
var tile = new Phaser.Tile(layer, gid, x, output.length, json.tilewidth, json.tileheight);
|
||||
|
||||
tile.rotation = rotation;
|
||||
tile.flipped = flipped;
|
||||
if ( flippedVal !== 0 )
|
||||
|
||||
if (flippedVal !== 0)
|
||||
{
|
||||
// the webgl renderer uses this to flip UV coordinates before drawing
|
||||
// The WebGL renderer uses this to flip UV coordinates before drawing
|
||||
tile.flippedVal = flippedVal;
|
||||
}
|
||||
row.push( tile );
|
||||
|
||||
row.push(tile);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -429,6 +432,7 @@ Phaser.TilemapParser = {
|
|||
// Tilesets & Image Collections
|
||||
var tilesets = [];
|
||||
var imagecollections = [];
|
||||
var lastSet = null;
|
||||
|
||||
for (var i = 0; i < json.tilesets.length; i++)
|
||||
{
|
||||
|
@ -447,6 +451,7 @@ Phaser.TilemapParser = {
|
|||
// For a normal sliced tileset the row/count/size information is computed when updated.
|
||||
// This is done (again) after the image is set.
|
||||
newSet.updateTileData(set.imagewidth, set.imageheight);
|
||||
|
||||
tilesets.push(newSet);
|
||||
}
|
||||
else
|
||||
|
@ -463,6 +468,13 @@ Phaser.TilemapParser = {
|
|||
imagecollections.push(newCollection);
|
||||
}
|
||||
|
||||
// We've got a new Tileset, so set the lastgid into the previous one
|
||||
if (lastSet)
|
||||
{
|
||||
lastSet.lastgid = set.firstgid - 1;
|
||||
}
|
||||
|
||||
lastSet = set;
|
||||
}
|
||||
|
||||
map.tilesets = tilesets;
|
||||
|
|
|
@ -39,6 +39,14 @@ Phaser.Tileset = function (name, firstgid, width, height, margin, spacing, prope
|
|||
*/
|
||||
this.firstgid = firstgid | 0;
|
||||
|
||||
/**
|
||||
* This is the ending index of the last tile index this Tileset can contain.
|
||||
* This is populated automatically by Phaser.TilemapParser.parseTiledJSON.
|
||||
* For a single tileset map it should be left as the default value.
|
||||
* @property {integer} lastgid
|
||||
*/
|
||||
this.lastgid = Infinity;
|
||||
|
||||
/**
|
||||
* The width of each tile (in pixels).
|
||||
* @property {integer} tileWidth
|
||||
|
@ -154,10 +162,10 @@ Phaser.Tileset.prototype = {
|
|||
},
|
||||
|
||||
/**
|
||||
* Draws a tile from this Tileset at the given coordinates using a WebGL renderer.
|
||||
* Sets the GL Batch data to draw a tile from this Tileset at the given coordinates
|
||||
* using a WebGL renderer.
|
||||
*
|
||||
* @method Phaser.Tileset#drawGl
|
||||
* @public
|
||||
* @param {Array} glBatch - A list of WebGL batch objects to draw later.
|
||||
* @param {number} x - The x coordinate to draw to.
|
||||
* @param {number} y - The y coordinate to draw to.
|
||||
|
@ -222,15 +230,15 @@ Phaser.Tileset.prototype = {
|
|||
},
|
||||
|
||||
/**
|
||||
* Adds a marker for the WebGl batch display to insert a degenerate triangle (eg. at the end of each row of tiles)
|
||||
* Adds a marker for the WebGL batch display to insert a degenerate
|
||||
* triangle (eg. at the end of each row of tiles)
|
||||
*
|
||||
* @method Phaser.Tileset#addDegenerate
|
||||
* @public
|
||||
* @param {[type]} glBatch [description]
|
||||
* @param {array} glBatch - The GL Batch data array.
|
||||
*/
|
||||
addDegenerate: function (glBatch) {
|
||||
|
||||
// don't insert multiple degenerate markers in a row
|
||||
// Don't insert multiple degenerate markers in a row
|
||||
if (glBatch[glBatch.length - 1])
|
||||
{
|
||||
glBatch.push(null);
|
||||
|
|
2
typescript/phaser.d.ts
vendored
2
typescript/phaser.d.ts
vendored
|
@ -5164,6 +5164,7 @@ declare module Phaser {
|
|||
columns: number;
|
||||
firstgid: number;
|
||||
image: any;
|
||||
lastgid: number;
|
||||
name: string;
|
||||
properties: any;
|
||||
rows: number;
|
||||
|
@ -5175,6 +5176,7 @@ declare module Phaser {
|
|||
|
||||
containsTileIndex(tileIndex: number): boolean;
|
||||
draw(context: CanvasRenderingContext2D, x: number, y: number, index: number): void;
|
||||
drawGl(glBatch: any[], x: number, y: number, index: number, alpha: number, flippedVal: number): void;
|
||||
setImage(image: any): void;
|
||||
setSpacing(margin?: number, spacing?: number): void;
|
||||
|
||||
|
|
Loading…
Reference in a new issue