Phaser.Game constructor can now be passed a single object containing game settings + Stage settings, useful for advanced configurations.

This commit is contained in:
photonstorm
2013-12-24 03:18:55 +00:00
parent 0acef49a7c
commit 167a498a5e
7 changed files with 254 additions and 68 deletions
-35
View File
@@ -411,35 +411,6 @@ Phaser.Loader.prototype = {
},
/**
* Add a new tile set to the loader. These are used in the rendering of tile maps.
*
* @method Phaser.Loader#tileset
* @param {string} key - Unique asset key of the tileset file.
* @param {string} url - URL of the tileset.
* @param {number} tileWidth - Width of each single tile in pixels.
* @param {number} tileHeight - Height of each single tile in pixels.
* @param {number} [tileMargin=0] - If the tiles have been drawn with a margin, specify the amount here.
* @param {number} [tileSpacing=0] - If the tiles have been drawn with spacing between them, specify the amount here.
* @param {number} [rows=-1] - How many tiles are placed horizontally in each row? If -1 it will calculate rows by dividing the image width by tileWidth.
* @param {number} [columns=-1] - How many tiles are placed vertically in each column? If -1 it will calculate columns by dividing the image height by tileHeight.
* @param {number} [total=-1] - The maximum number of tiles to extract from the image. If -1 it will extract `rows * columns` worth. You can also set a value lower than the actual number of tiles.
* @return {Phaser.Loader} This Loader instance.
*/
tileset: function (key, url, tileWidth, tileHeight, tileMargin, tileSpacing, rows, columns, total) {
if (typeof tileMargin === "undefined") { tileMargin = 0; }
if (typeof tileSpacing === "undefined") { tileSpacing = 0; }
if (typeof rows === "undefined") { rows = -1; }
if (typeof columns === "undefined") { columns = -1; }
if (typeof total === "undefined") { total = -1; }
this.addToFileList('tileset', key, url, { tileWidth: tileWidth, tileHeight: tileHeight, tileMargin: tileMargin, tileSpacing: tileSpacing, rows: rows, columns: columns, total: total });
return this;
},
/**
* Add a new audio file to the loader.
*
@@ -786,7 +757,6 @@ Phaser.Loader.prototype = {
case 'spritesheet':
case 'textureatlas':
case 'bitmapfont':
case 'tileset':
file.data = new Image();
file.data.name = file.key;
file.data.onload = function () {
@@ -983,11 +953,6 @@ Phaser.Loader.prototype = {
this.game.cache.addSpriteSheet(file.key, file.url, file.data, file.frameWidth, file.frameHeight, file.frameMax, file.margin, file.spacing);
break;
case 'tileset':
this.game.cache.addTileset(file.key, file.url, file.data, file.tileWidth, file.tileHeight, file.tileMargin, file.tileSpacing, file.rows, file.columns, file.total);
break;
case 'textureatlas':
if (file.atlasURL == null)