mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 05:03:37 +00:00
* Cache.getFrame has a new cache
parameter (that defaults to the Image cache, but can be changed to any other)
* Cache.getFrameCount has a new `cache` parameter (that defaults to the Image cache, but can be changed to any other) * Cache.getFrameData has a new `cache` parameter (that defaults to the Image cache, but can be changed to any other) * Cache.hasFrameData has a new `cache` parameter (that defaults to the Image cache, but can be changed to any other) * Cache.getFrameByIndex has a new `cache` parameter (that defaults to the Image cache, but can be changed to any other) * Cache.getFrameByName has a new `cache` parameter (that defaults to the Image cache, but can be changed to any other) re: #1935
This commit is contained in:
parent
2e12cd70ed
commit
50480d815f
3 changed files with 37 additions and 18 deletions
|
@ -250,6 +250,13 @@ If you are an exceptional JavaScript developer and would like to join the Phaser
|
||||||
|
|
||||||
* TypeScript definitions fixes and updates (thanks @clark-stevenson @shivinsky)
|
* TypeScript definitions fixes and updates (thanks @clark-stevenson @shivinsky)
|
||||||
* TilemapLayer - Fixed unmatched `context.save` and `context.restore` calls (thanks @MortimerGoro #1934)
|
* TilemapLayer - Fixed unmatched `context.save` and `context.restore` calls (thanks @MortimerGoro #1934)
|
||||||
|
* Cache.getFrame has a new `cache` parameter (that defaults to the Image cache, but can be changed to any other)
|
||||||
|
* Cache.getFrameCount has a new `cache` parameter (that defaults to the Image cache, but can be changed to any other)
|
||||||
|
* Cache.getFrameData has a new `cache` parameter (that defaults to the Image cache, but can be changed to any other)
|
||||||
|
* Cache.hasFrameData has a new `cache` parameter (that defaults to the Image cache, but can be changed to any other)
|
||||||
|
* Cache.getFrameByIndex has a new `cache` parameter (that defaults to the Image cache, but can be changed to any other)
|
||||||
|
* Cache.getFrameByName has a new `cache` parameter (that defaults to the Image cache, but can be changed to any other)
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|
||||||
|
|
|
@ -1404,11 +1404,14 @@ Phaser.Cache.prototype = {
|
||||||
*
|
*
|
||||||
* @method Phaser.Cache#getFrame
|
* @method Phaser.Cache#getFrame
|
||||||
* @param {string} key - Asset key of the frame data to retrieve from the Cache.
|
* @param {string} key - Asset key of the frame data to retrieve from the Cache.
|
||||||
|
* @param {integer} [cache=Phaser.Cache.IMAGE] - The cache to search for the item in.
|
||||||
* @return {Phaser.Frame} The frame data.
|
* @return {Phaser.Frame} The frame data.
|
||||||
*/
|
*/
|
||||||
getFrame: function (key) {
|
getFrame: function (key, cache) {
|
||||||
|
|
||||||
return this.getItem(key, Phaser.Cache.IMAGE, 'getFrame', 'frame');
|
if (cache === undefined) { cache = Phaser.Cache.IMAGE; }
|
||||||
|
|
||||||
|
return this.getItem(key, cache, 'getFrame', 'frame');
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1417,11 +1420,12 @@ Phaser.Cache.prototype = {
|
||||||
*
|
*
|
||||||
* @method Phaser.Cache#getFrameCount
|
* @method Phaser.Cache#getFrameCount
|
||||||
* @param {string} key - Asset key of the FrameData you want.
|
* @param {string} key - Asset key of the FrameData you want.
|
||||||
|
* @param {integer} [cache=Phaser.Cache.IMAGE] - The cache to search for the item in.
|
||||||
* @return {number} Then number of frames. 0 if the image is not found.
|
* @return {number} Then number of frames. 0 if the image is not found.
|
||||||
*/
|
*/
|
||||||
getFrameCount: function (key) {
|
getFrameCount: function (key, cache) {
|
||||||
|
|
||||||
var data = this.getFrameData(key);
|
var data = this.getFrameData(key, cache);
|
||||||
|
|
||||||
if (data)
|
if (data)
|
||||||
{
|
{
|
||||||
|
@ -1443,11 +1447,14 @@ Phaser.Cache.prototype = {
|
||||||
*
|
*
|
||||||
* @method Phaser.Cache#getFrameData
|
* @method Phaser.Cache#getFrameData
|
||||||
* @param {string} key - Asset key of the frame data to retrieve from the Cache.
|
* @param {string} key - Asset key of the frame data to retrieve from the Cache.
|
||||||
|
* @param {integer} [cache=Phaser.Cache.IMAGE] - The cache to search for the item in.
|
||||||
* @return {Phaser.FrameData} The frame data.
|
* @return {Phaser.FrameData} The frame data.
|
||||||
*/
|
*/
|
||||||
getFrameData: function (key) {
|
getFrameData: function (key, cache) {
|
||||||
|
|
||||||
return this.getItem(key, Phaser.Cache.IMAGE, 'getFrameData', 'frameData');
|
if (cache === undefined) { cache = Phaser.Cache.IMAGE; }
|
||||||
|
|
||||||
|
return this.getItem(key, cache, 'getFrameData', 'frameData');
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1456,11 +1463,14 @@ Phaser.Cache.prototype = {
|
||||||
*
|
*
|
||||||
* @method Phaser.Cache#hasFrameData
|
* @method Phaser.Cache#hasFrameData
|
||||||
* @param {string} key - Asset key of the frame data to retrieve from the Cache.
|
* @param {string} key - Asset key of the frame data to retrieve from the Cache.
|
||||||
|
* @param {integer} [cache=Phaser.Cache.IMAGE] - The cache to search for the item in.
|
||||||
* @return {boolean} True if the given key has frameData in the cache, otherwise false.
|
* @return {boolean} True if the given key has frameData in the cache, otherwise false.
|
||||||
*/
|
*/
|
||||||
hasFrameData: function (key) {
|
hasFrameData: function (key, cache) {
|
||||||
|
|
||||||
return (this.getItem(key, Phaser.Cache.IMAGE, '', 'frameData') !== null);
|
if (cache === undefined) { cache = Phaser.Cache.IMAGE; }
|
||||||
|
|
||||||
|
return (this.getItem(key, cache, '', 'frameData') !== null);
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1489,11 +1499,12 @@ Phaser.Cache.prototype = {
|
||||||
* @method Phaser.Cache#getFrameByIndex
|
* @method Phaser.Cache#getFrameByIndex
|
||||||
* @param {string} key - Asset key of the frame data to retrieve from the Cache.
|
* @param {string} key - Asset key of the frame data to retrieve from the Cache.
|
||||||
* @param {number} index - The index of the frame you want to get.
|
* @param {number} index - The index of the frame you want to get.
|
||||||
|
* @param {integer} [cache=Phaser.Cache.IMAGE] - The cache to search. One of the Cache consts such as `Phaser.Cache.IMAGE` or `Phaser.Cache.SOUND`.
|
||||||
* @return {Phaser.Frame} The frame object.
|
* @return {Phaser.Frame} The frame object.
|
||||||
*/
|
*/
|
||||||
getFrameByIndex: function (key, index) {
|
getFrameByIndex: function (key, index, cache) {
|
||||||
|
|
||||||
var data = this.getFrameData(key);
|
var data = this.getFrameData(key, cache);
|
||||||
|
|
||||||
if (data)
|
if (data)
|
||||||
{
|
{
|
||||||
|
@ -1512,11 +1523,12 @@ Phaser.Cache.prototype = {
|
||||||
* @method Phaser.Cache#getFrameByName
|
* @method Phaser.Cache#getFrameByName
|
||||||
* @param {string} key - Asset key of the frame data to retrieve from the Cache.
|
* @param {string} key - Asset key of the frame data to retrieve from the Cache.
|
||||||
* @param {string} name - The name of the frame you want to get.
|
* @param {string} name - The name of the frame you want to get.
|
||||||
|
* @param {integer} [cache=Phaser.Cache.IMAGE] - The cache to search. One of the Cache consts such as `Phaser.Cache.IMAGE` or `Phaser.Cache.SOUND`.
|
||||||
* @return {Phaser.Frame} The frame object.
|
* @return {Phaser.Frame} The frame object.
|
||||||
*/
|
*/
|
||||||
getFrameByName: function (key, name) {
|
getFrameByName: function (key, name, cache) {
|
||||||
|
|
||||||
var data = this.getFrameData(key);
|
var data = this.getFrameData(key, cache);
|
||||||
|
|
||||||
if (data)
|
if (data)
|
||||||
{
|
{
|
||||||
|
|
12
typescript/phaser.d.ts
vendored
12
typescript/phaser.d.ts
vendored
|
@ -460,11 +460,11 @@ declare module Phaser {
|
||||||
getBitmapData(key: string): Phaser.BitmapData;
|
getBitmapData(key: string): Phaser.BitmapData;
|
||||||
getBitmapFont(key: string): Phaser.RetroFont;
|
getBitmapFont(key: string): Phaser.RetroFont;
|
||||||
getCanvas(key: string): HTMLCanvasElement;
|
getCanvas(key: string): HTMLCanvasElement;
|
||||||
getFrame(key: string): Phaser.Frame;
|
getFrame(key: string, cache?: number): Phaser.Frame;
|
||||||
getFrameByIndex(key: string, index: number): Phaser.Frame;
|
getFrameByIndex(key: string, index: number, cache?: number): Phaser.Frame;
|
||||||
getFrameByName(key: string, name: string): Phaser.Frame;
|
getFrameByName(key: string, name: string, cache?: number): Phaser.Frame;
|
||||||
getFrameCount(key: string): number;
|
getFrameCount(key: string, cache?: number): number;
|
||||||
getFrameData(key: string): Phaser.FrameData;
|
getFrameData(key: string, cache?: number): Phaser.FrameData;
|
||||||
getImage(key: string, full?: boolean): Phaser.Image;
|
getImage(key: string, full?: boolean): Phaser.Image;
|
||||||
getItem(key: string, cache: number, method?: string, property?: string): any;
|
getItem(key: string, cache: number, method?: string, property?: string): any;
|
||||||
getJSON(key: string, clone?: boolean): any;
|
getJSON(key: string, clone?: boolean): any;
|
||||||
|
@ -487,7 +487,7 @@ declare module Phaser {
|
||||||
getURL(url: string): any;
|
getURL(url: string): any;
|
||||||
getXML(key: string): any;
|
getXML(key: string): any;
|
||||||
getVideo(key: string): Phaser.Video;
|
getVideo(key: string): Phaser.Video;
|
||||||
hasFrameData(key: string): boolean;
|
hasFrameData(key: string, cache?: number): boolean;
|
||||||
isSoundDecoded(key: string): boolean;
|
isSoundDecoded(key: string): boolean;
|
||||||
isSoundReady(key: string): boolean;
|
isSoundReady(key: string): boolean;
|
||||||
isSpriteSheet(key: string): boolean;
|
isSpriteSheet(key: string): boolean;
|
||||||
|
|
Loading…
Reference in a new issue