mirror of
https://github.com/wassname/phaser.git
synced 2026-09-09 11:28:47 +08:00
Updated IE11 check, forces IE11 to use Canvas renderer even in AUTO mode.
This commit is contained in:
+11
-6
@@ -132,16 +132,18 @@ Phaser.Cache.prototype = {
|
||||
* @param {object} data - Extra sprite sheet data.
|
||||
* @param {number} frameWidth - Width of the sprite sheet.
|
||||
* @param {number} frameHeight - Height of the sprite sheet.
|
||||
* @param {number} frameMax - How many frames stored in the sprite sheet.
|
||||
* @param {number} [frameMax=-1] - How many frames stored in the sprite sheet. If -1 then it divides the whole sheet evenly.
|
||||
* @param {number} [margin=0] - If the frames have been drawn with a margin, specify the amount here.
|
||||
* @param {number} [spacing=0] - If the frames have been drawn with spacing between them, specify the amount here.
|
||||
*/
|
||||
addSpriteSheet: function (key, url, data, frameWidth, frameHeight, frameMax) {
|
||||
addSpriteSheet: function (key, url, data, frameWidth, frameHeight, frameMax, margin, spacing) {
|
||||
|
||||
this._images[key] = { url: url, data: data, spriteSheet: true, frameWidth: frameWidth, frameHeight: frameHeight };
|
||||
this._images[key] = { url: url, data: data, spriteSheet: true, frameWidth: frameWidth, frameHeight: frameHeight, margin: margin, spacing: spacing };
|
||||
|
||||
PIXI.BaseTextureCache[key] = new PIXI.BaseTexture(data);
|
||||
PIXI.TextureCache[key] = new PIXI.Texture(PIXI.BaseTextureCache[key]);
|
||||
|
||||
this._images[key].frameData = Phaser.AnimationParser.spriteSheet(this.game, key, frameWidth, frameHeight, frameMax);
|
||||
this._images[key].frameData = Phaser.AnimationParser.spriteSheet(this.game, key, frameWidth, frameHeight, frameMax, margin, spacing);
|
||||
|
||||
},
|
||||
|
||||
@@ -339,6 +341,7 @@ Phaser.Cache.prototype = {
|
||||
|
||||
/**
|
||||
* Reload a sound.
|
||||
*
|
||||
* @method Phaser.Cache#reloadSound
|
||||
* @param {string} key - Asset key for the sound.
|
||||
*/
|
||||
@@ -359,7 +362,8 @@ Phaser.Cache.prototype = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* Fires the onSoundUnlock event when the sound has completed reloading.
|
||||
*
|
||||
* @method Phaser.Cache#reloadSoundComplete
|
||||
* @param {string} key - Asset key for the sound.
|
||||
*/
|
||||
@@ -374,7 +378,8 @@ Phaser.Cache.prototype = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* Updates the sound object in the cache.
|
||||
*
|
||||
* @method Phaser.Cache#updateSound
|
||||
* @param {string} key - Asset key for the sound.
|
||||
*/
|
||||
|
||||
@@ -372,13 +372,17 @@ Phaser.Loader.prototype = {
|
||||
* @param {number} frameWidth - Width of each single frame.
|
||||
* @param {number} frameHeight - Height of each single frame.
|
||||
* @param {number} [frameMax=-1] - How many frames in this sprite sheet. If not specified it will divide the whole image into frames.
|
||||
* @param {number} [margin=0] - If the frames have been drawn with a margin, specify the amount here.
|
||||
* @param {number} [spacing=0] - If the frames have been drawn with spacing between them, specify the amount here.
|
||||
* @return {Phaser.Loader} This Loader instance.
|
||||
*/
|
||||
spritesheet: function (key, url, frameWidth, frameHeight, frameMax) {
|
||||
spritesheet: function (key, url, frameWidth, frameHeight, frameMax, margin, spacing) {
|
||||
|
||||
if (typeof frameMax === "undefined") { frameMax = -1; }
|
||||
if (typeof margin === "undefined") { margin = 0; }
|
||||
if (typeof spacing === "undefined") { spacing = 0; }
|
||||
|
||||
this.addToFileList('spritesheet', key, url, { frameWidth: frameWidth, frameHeight: frameHeight, frameMax: frameMax });
|
||||
this.addToFileList('spritesheet', key, url, { frameWidth: frameWidth, frameHeight: frameHeight, frameMax: frameMax, margin: margin, spacing: spacing });
|
||||
|
||||
return this;
|
||||
|
||||
@@ -950,7 +954,7 @@ Phaser.Loader.prototype = {
|
||||
|
||||
case 'spritesheet':
|
||||
|
||||
this.game.cache.addSpriteSheet(file.key, file.url, file.data, file.frameWidth, file.frameHeight, file.frameMax);
|
||||
this.game.cache.addSpriteSheet(file.key, file.url, file.data, file.frameWidth, file.frameHeight, file.frameMax, file.margin, file.spacing);
|
||||
break;
|
||||
|
||||
case 'tileset':
|
||||
@@ -1038,6 +1042,7 @@ Phaser.Loader.prototype = {
|
||||
if (buffer)
|
||||
{
|
||||
that.game.cache.decodedSound(key, buffer);
|
||||
that.game.sound.onSoundDecode.dispatch(key, that.game.cache.getSound(key));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user