This commit is contained in:
Greg 2018-02-09 16:28:41 -05:00
commit 8563c69879
62 changed files with 4091 additions and 411 deletions

View file

@ -8,8 +8,18 @@ var ParseXMLBitmapFont = require('../gameobjects/bitmaptext/ParseXMLBitmapFont')
var PluginManager = require('../plugins/PluginManager'); var PluginManager = require('../plugins/PluginManager');
var XHRSettings = require('./XHRSettings'); var XHRSettings = require('./XHRSettings');
// Phaser.Loader.LoaderPlugin /**
* @classdesc
* [description]
*
* @class LoaderPlugin
* @extends Phaser.Loader.EventEmitter
* @memberOf Phaser.Loader
* @constructor
* @since 3.0.0
*
* @param {Phaser.Scene} scene - [description]
*/
var LoaderPlugin = new Class({ var LoaderPlugin = new Class({
Extends: EventEmitter, Extends: EventEmitter,
@ -20,8 +30,22 @@ var LoaderPlugin = new Class({
{ {
EventEmitter.call(this); EventEmitter.call(this);
/**
* [description]
*
* @name Phaser.Loader.LoaderPlugin#scene
* @type {Phaser.Scene}
* @since 3.0.0
*/
this.scene = scene; this.scene = scene;
/**
* [description]
*
* @name Phaser.Loader.LoaderPlugin#systems
* @type {Phaser.Scenes.Systems}
* @since 3.0.0
*/
this.systems = scene.sys; this.systems = scene.sys;
if (!scene.sys.settings.isBooted) if (!scene.sys.settings.isBooted)
@ -29,6 +53,15 @@ var LoaderPlugin = new Class({
scene.sys.events.once('boot', this.boot, this); scene.sys.events.once('boot', this.boot, this);
} }
/**
* [description]
*
* @name Phaser.Loader.LoaderPlugin#_multilist
* @type {object}
* @private
* @default {}
* @since 3.0.0
*/
this._multilist = {}; this._multilist = {};
// Inject the available filetypes into the Loader // Inject the available filetypes into the Loader
@ -37,16 +70,55 @@ var LoaderPlugin = new Class({
var gameConfig = this.systems.game.config; var gameConfig = this.systems.game.config;
var sceneConfig = this.systems.settings.loader; var sceneConfig = this.systems.settings.loader;
/**
* [description]
*
* @name Phaser.Loader.LoaderPlugin#path
* @type {string}
* @default ''
* @since 3.0.0
*/
this.path = ''; this.path = '';
/**
* [description]
*
* @name Phaser.Loader.LoaderPlugin#baseURL
* @type {string}
* @default ''
* @since 3.0.0
*/
this.baseURL = ''; this.baseURL = '';
this.setBaseURL(GetFastValue(sceneConfig, 'baseURL', gameConfig.loaderBaseURL)); this.setBaseURL(GetFastValue(sceneConfig, 'baseURL', gameConfig.loaderBaseURL));
this.setPath(GetFastValue(sceneConfig, 'path', gameConfig.loaderPath)); this.setPath(GetFastValue(sceneConfig, 'path', gameConfig.loaderPath));
/**
* [description]
*
* @name Phaser.Loader.LoaderPlugin#enableParallel
* @type {boolean}
* @since 3.0.0
*/
this.enableParallel = GetFastValue(sceneConfig, 'enableParallel', gameConfig.loaderEnableParallel); this.enableParallel = GetFastValue(sceneConfig, 'enableParallel', gameConfig.loaderEnableParallel);
/**
* [description]
*
* @name Phaser.Loader.LoaderPlugin#maxParallelDownloads
* @type {integer}
* @since 3.0.0
*/
this.maxParallelDownloads = GetFastValue(sceneConfig, 'maxParallelDownloads', gameConfig.loaderMaxParallelDownloads); this.maxParallelDownloads = GetFastValue(sceneConfig, 'maxParallelDownloads', gameConfig.loaderMaxParallelDownloads);
// xhr specific global settings (can be overridden on a per-file basis) /**
* xhr specific global settings (can be overridden on a per-file basis)
*
* @name Phaser.Loader.LoaderPlugin#xhr
* @type {Phaser.Loader.XHRSettings}
* @since 3.0.0
*/
this.xhr = XHRSettings( this.xhr = XHRSettings(
GetFastValue(sceneConfig, 'responseType', gameConfig.loaderResponseType), GetFastValue(sceneConfig, 'responseType', gameConfig.loaderResponseType),
GetFastValue(sceneConfig, 'async', gameConfig.loaderAsync), GetFastValue(sceneConfig, 'async', gameConfig.loaderAsync),
@ -55,20 +127,96 @@ var LoaderPlugin = new Class({
GetFastValue(sceneConfig, 'timeout', gameConfig.loaderTimeout) GetFastValue(sceneConfig, 'timeout', gameConfig.loaderTimeout)
); );
/**
* [description]
*
* @name Phaser.Loader.LoaderPlugin#crossOrigin
* @type {string}
* @since 3.0.0
*/
this.crossOrigin = GetFastValue(sceneConfig, 'crossOrigin', gameConfig.loaderCrossOrigin); this.crossOrigin = GetFastValue(sceneConfig, 'crossOrigin', gameConfig.loaderCrossOrigin);
/**
* [description]
*
* @name Phaser.Loader.LoaderPlugin#totalToLoad
* @type {number}
* @default 0
* @since 3.0.0
*/
this.totalToLoad = 0; this.totalToLoad = 0;
/**
* [description]
*
* @name Phaser.Loader.LoaderPlugin#progress
* @type {number}
* @default 0
* @since 3.0.0
*/
this.progress = 0; this.progress = 0;
/**
* [description]
*
* @name Phaser.Loader.LoaderPlugin#list
* @type {Phaser.Structs.Set}
* @since 3.0.0
*/
this.list = new CustomSet(); this.list = new CustomSet();
/**
* [description]
*
* @name Phaser.Loader.LoaderPlugin#inflight
* @type {Phaser.Structs.Set}
* @since 3.0.0
*/
this.inflight = new CustomSet(); this.inflight = new CustomSet();
/**
* [description]
*
* @name Phaser.Loader.LoaderPlugin#failed
* @type {Phaser.Structs.Set}
* @since 3.0.0
*/
this.failed = new CustomSet(); this.failed = new CustomSet();
/**
* [description]
*
* @name Phaser.Loader.LoaderPlugin#queue
* @type {Phaser.Structs.Set}
* @since 3.0.0
*/
this.queue = new CustomSet(); this.queue = new CustomSet();
/**
* [description]
*
* @name Phaser.Loader.LoaderPlugin#storage
* @type {Phaser.Structs.Set}
* @since 3.0.0
*/
this.storage = new CustomSet(); this.storage = new CustomSet();
/**
* [description]
*
* @name Phaser.Loader.LoaderPlugin#state
* @type {integer}
* @since 3.0.0
*/
this.state = CONST.LOADER_IDLE; this.state = CONST.LOADER_IDLE;
}, },
/**
* [description]
*
* @method Phaser.Loader.LoaderPlugin#boot
* @since 3.0.0
*/
boot: function () boot: function ()
{ {
var eventEmitter = this.systems.events; var eventEmitter = this.systems.events;
@ -77,6 +225,16 @@ var LoaderPlugin = new Class({
eventEmitter.on('destroy', this.destroy, this); eventEmitter.on('destroy', this.destroy, this);
}, },
/**
* [description]
*
* @method Phaser.Loader.LoaderPlugin#setBaseURL
* @since 3.0.0
*
* @param {string} url - [description]
*
* @return {Phaser.Loader.LoaderPlugin} This Loader object.
*/
setBaseURL: function (url) setBaseURL: function (url)
{ {
if (url !== '' && url.substr(-1) !== '/') if (url !== '' && url.substr(-1) !== '/')
@ -89,6 +247,16 @@ var LoaderPlugin = new Class({
return this; return this;
}, },
/**
* [description]
*
* @method Phaser.Loader.LoaderPlugin#setPath
* @since 3.0.0
*
* @param {string} path - [description]
*
* @return {Phaser.Loader.LoaderPlugin} This Loader object.
*/
setPath: function (path) setPath: function (path)
{ {
if (path !== '' && path.substr(-1) !== '/') if (path !== '' && path.substr(-1) !== '/')
@ -101,6 +269,16 @@ var LoaderPlugin = new Class({
return this; return this;
}, },
/**
* [description]
*
* @method Phaser.Loader.LoaderPlugin#addFile
* @since 3.0.0
*
* @param {Phaser.Loader.File} file - [description]
*
* @return {Phaser.Loader.File} [description]
*/
addFile: function (file) addFile: function (file)
{ {
if (!this.isReady()) if (!this.isReady())
@ -115,22 +293,40 @@ var LoaderPlugin = new Class({
return file; return file;
}, },
// Is the Loader actively loading (or processing loaded files) /**
* Is the Loader actively loading (or processing loaded files)
*
* @method Phaser.Loader.LoaderPlugin#isLoading
* @since 3.0.0
*
* @return {boolean} [description]
*/
isLoading: function () isLoading: function ()
{ {
return (this.state === CONST.LOADER_LOADING || this.state === CONST.LOADER_PROCESSING); return (this.state === CONST.LOADER_LOADING || this.state === CONST.LOADER_PROCESSING);
}, },
// Is the Loader ready to start a new load? /**
* Is the Loader ready to start a new load?
*
* @method Phaser.Loader.LoaderPlugin#isReady
* @since 3.0.0
*
* @return {boolean} [description]
*/
isReady: function () isReady: function ()
{ {
return (this.state === CONST.LOADER_IDLE || this.state === CONST.LOADER_COMPLETE || this.state === CONST.LOADER_FAILED); return (this.state === CONST.LOADER_IDLE || this.state === CONST.LOADER_COMPLETE || this.state === CONST.LOADER_FAILED);
}, },
/**
* [description]
*
* @method Phaser.Loader.LoaderPlugin#start
* @since 3.0.0
*/
start: function () start: function ()
{ {
// console.log(this.scene.sys.settings.key, '- Loader start. Files to load:', this.list.size);
if (!this.isReady()) if (!this.isReady())
{ {
return; return;
@ -161,21 +357,27 @@ var LoaderPlugin = new Class({
} }
}, },
/**
* [description]
*
* @method Phaser.Loader.LoaderPlugin#updateProgress
* @since 3.0.0
*/
updateProgress: function () updateProgress: function ()
{ {
this.progress = 1 - (this.list.size / this.totalToLoad); this.progress = 1 - (this.list.size / this.totalToLoad);
// console.log(this.progress);
this.emit('progress', this.progress); this.emit('progress', this.progress);
}, },
/**
* [description]
*
* @method Phaser.Loader.LoaderPlugin#processLoadQueue
* @since 3.0.0
*/
processLoadQueue: function () processLoadQueue: function ()
{ {
// console.log('======== LoaderPlugin processLoadQueue');
// console.log('List size', this.list.size);
// console.log(this.inflight.size, 'items still in flight. Can load another', (this.maxParallelDownloads - this.inflight.size));
this.list.each(function (file) this.list.each(function (file)
{ {
if (file.state === CONST.FILE_POPULATED || (file.state === CONST.FILE_PENDING && this.inflight.size < this.maxParallelDownloads)) if (file.state === CONST.FILE_POPULATED || (file.state === CONST.FILE_PENDING && this.inflight.size < this.maxParallelDownloads))
@ -196,11 +398,16 @@ var LoaderPlugin = new Class({
}, this); }, this);
}, },
// private /**
* [description]
*
* @method Phaser.Loader.LoaderPlugin#loadFile
* @since 3.0.0
*
* @param {Phaser.Loader.File} file - [description]
*/
loadFile: function (file) loadFile: function (file)
{ {
// console.log('LOADING', file.key);
// If the file doesn't have its own crossOrigin set, // If the file doesn't have its own crossOrigin set,
// we'll use the Loaders (which is undefined by default) // we'll use the Loaders (which is undefined by default)
if (!file.crossOrigin) if (!file.crossOrigin)
@ -211,10 +418,17 @@ var LoaderPlugin = new Class({
file.load(this); file.load(this);
}, },
/**
* [description]
*
* @method Phaser.Loader.LoaderPlugin#nextFile
* @since 3.0.0
*
* @param {Phaser.Loader.File} previousFile - [description]
* @param {boolean} success - [description]
*/
nextFile: function (previousFile, success) nextFile: function (previousFile, success)
{ {
// console.log('LOADED:', previousFile.src, success);
// Move the file that just loaded from the inflight list to the queue or failed Set // Move the file that just loaded from the inflight list to the queue or failed Set
if (success) if (success)
@ -234,20 +448,22 @@ var LoaderPlugin = new Class({
if (this.list.size > 0) if (this.list.size > 0)
{ {
// console.log('nextFile - still something in the list');
this.processLoadQueue(); this.processLoadQueue();
} }
else if (this.inflight.size === 0) else if (this.inflight.size === 0)
{ {
// console.log('nextFile calling finishedLoading');
this.finishedLoading(); this.finishedLoading();
} }
}, },
/**
* [description]
*
* @method Phaser.Loader.LoaderPlugin#finishedLoading
* @since 3.0.0
*/
finishedLoading: function () finishedLoading: function ()
{ {
// console.log('---> LoaderPlugin.finishedLoading PROCESSING', this.queue.size, 'files');
if (this.state === CONST.LOADER_PROCESSING) if (this.state === CONST.LOADER_PROCESSING)
{ {
return; return;
@ -268,17 +484,21 @@ var LoaderPlugin = new Class({
{ {
this.queue.each(function (file) this.queue.each(function (file)
{ {
// console.log('%c Calling process on ' + file.key, 'color: #000000; background: #ffff00;');
file.onProcess(this.processUpdate.bind(this)); file.onProcess(this.processUpdate.bind(this));
}, this); }, this);
} }
}, },
// Called automatically by the File when it has finished processing /**
* Called automatically by the File when it has finished processing.
*
* @method Phaser.Loader.LoaderPlugin#processUpdate
* @since 3.0.0
*
* @param {Phaser.Loader.File} file - [description]
*/
processUpdate: function (file) processUpdate: function (file)
{ {
// console.log('-> processUpdate', file.key, file.state);
// This file has failed to load, so move it to the failed Set // This file has failed to load, so move it to the failed Set
if (file.state === CONST.FILE_ERRORED) if (file.state === CONST.FILE_ERRORED)
{ {
@ -317,6 +537,14 @@ var LoaderPlugin = new Class({
} }
}, },
/**
* [description]
*
* @method Phaser.Loader.LoaderPlugin#removeFromQueue
* @since 3.0.0
*
* @param {Phaser.Loader.File} file - [description]
*/
removeFromQueue: function (file) removeFromQueue: function (file)
{ {
this.queue.delete(file); this.queue.delete(file);
@ -328,10 +556,14 @@ var LoaderPlugin = new Class({
} }
}, },
/**
* [description]
*
* @method Phaser.Loader.LoaderPlugin#processComplete
* @since 3.0.0
*/
processComplete: function () processComplete: function ()
{ {
// console.log(this.scene.sys.settings.key, '- Loader Complete. Loaded:', this.storage.size, 'Failed:', this.failed.size);
this.list.clear(); this.list.clear();
this.inflight.clear(); this.inflight.clear();
this.queue.clear(); this.queue.clear();
@ -345,7 +577,12 @@ var LoaderPlugin = new Class({
this.removeAllListeners(); this.removeAllListeners();
}, },
// The Loader has finished /**
* The Loader has finished.
*
* @method Phaser.Loader.LoaderPlugin#processCallback
* @since 3.0.0
*/
processCallback: function () processCallback: function ()
{ {
if (this.storage.size === 0) if (this.storage.size === 0)
@ -545,11 +782,34 @@ var LoaderPlugin = new Class({
this.storage.clear(); this.storage.clear();
}, },
/**
* [description]
*
* @method Phaser.Loader.LoaderPlugin#saveJSON
* @since 3.0.0
*
* @param {[type]} data - [description]
* @param {[type]} filename - [description]
*
* @return {[type]} [description]
*/
saveJSON: function (data, filename) saveJSON: function (data, filename)
{ {
return this.save(JSON.stringify(data), filename); return this.save(JSON.stringify(data), filename);
}, },
/**
* [description]
*
* @method Phaser.Loader.LoaderPlugin#save
* @since 3.0.0
*
* @param {[type]} data - [description]
* @param {[type]} filename - [description]
* @param {[type]} filetype - [description]
*
* @return {Phaser.Loader.LoaderPlugin} This Loader plugin.
*/
save: function (data, filename, filetype) save: function (data, filename, filetype)
{ {
if (filename === undefined) { filename = 'file.json'; } if (filename === undefined) { filename = 'file.json'; }
@ -569,6 +829,12 @@ var LoaderPlugin = new Class({
return this; return this;
}, },
/**
* [description]
*
* @method Phaser.Loader.LoaderPlugin#reset
* @since 3.0.0
*/
reset: function () reset: function ()
{ {
this.list.clear(); this.list.clear();
@ -586,6 +852,16 @@ var LoaderPlugin = new Class({
this.state = CONST.LOADER_IDLE; this.state = CONST.LOADER_IDLE;
}, },
/**
* [description]
*
* @method Phaser.Loader.LoaderPlugin#loadArray
* @since 3.0.0
*
* @param {array} files - [description]
*
* @return {boolean} [description]
*/
loadArray: function (files) loadArray: function (files)
{ {
if (Array.isArray(files)) if (Array.isArray(files))
@ -599,6 +875,16 @@ var LoaderPlugin = new Class({
return (this.list.size > 0); return (this.list.size > 0);
}, },
/**
* [description]
*
* @method Phaser.Loader.LoaderPlugin#file
* @since 3.0.0
*
* @param {object} file - [description]
*
* @return {Phaser.Loader.File} [description]
*/
file: function (file) file: function (file)
{ {
var entry; var entry;
@ -635,12 +921,24 @@ var LoaderPlugin = new Class({
return entry; return entry;
}, },
/**
* [description]
*
* @method Phaser.Loader.LoaderPlugin#shutdown
* @since 3.0.0
*/
shutdown: function () shutdown: function ()
{ {
this.reset(); this.reset();
this.state = CONST.LOADER_SHUTDOWN; this.state = CONST.LOADER_SHUTDOWN;
}, },
/**
* [description]
*
* @method Phaser.Loader.LoaderPlugin#destroy
* @since 3.0.0
*/
destroy: function () destroy: function ()
{ {
this.reset(); this.reset();

View file

@ -32,8 +32,6 @@ var AnimationJSONFile = function (key, url, path, xhrSettings)
* The file is **not** loaded immediately after calling this method. * The file is **not** loaded immediately after calling this method.
* Instead, the file is added to a queue within the Loader, which is processed automatically when the Loader starts. * Instead, the file is added to a queue within the Loader, which is processed automatically when the Loader starts.
* *
*
*
* @method Phaser.Loader.LoaderPlugin#animation * @method Phaser.Loader.LoaderPlugin#animation
* @since 3.0.0 * @since 3.0.0
* *

View file

@ -33,6 +33,25 @@ var AtlasJSONFile = function (key, textureURL, atlasURL, path, textureXhrSetting
return { texture: image, data: data }; return { texture: image, data: data };
}; };
/**
* Adds a Texture Atlas file to the current load queue.
*
* Note: This method will only be available if the Atlas JSON File type has been built into Phaser.
*
* The file is **not** loaded immediately after calling this method.
* Instead, the file is added to a queue within the Loader, which is processed automatically when the Loader starts.
*
* @method Phaser.Loader.LoaderPlugin#atlas
* @since 3.0.0
*
* @param {string} key - The key of the file within the loader.
* @param {string} textureURL - The url to load the texture file from.
* @param {string} atlasURL - The url to load the atlas file from.
* @param {object} textureXhrSettings - Optional texture file specific XHR settings.
* @param {object} atlasXhrSettings - Optional atlas file specific XHR settings.
*
* @return {Phaser.Loader.LoaderPlugin} The Loader.
*/
FileTypesManager.register('atlas', function (key, textureURL, atlasURL, textureXhrSettings, atlasXhrSettings) FileTypesManager.register('atlas', function (key, textureURL, atlasURL, textureXhrSettings, atlasXhrSettings)
{ {
// Returns an object with two properties: 'texture' and 'data' // Returns an object with two properties: 'texture' and 'data'

View file

@ -95,16 +95,6 @@ AudioFile.create = function (loader, key, urls, config, xhrSettings)
var audioConfig = game.config.audio; var audioConfig = game.config.audio;
var deviceAudio = game.device.audio; var deviceAudio = game.device.audio;
/**
* [description]
*
* @method Phaser.Loader.FileTypes.AudioFile#
* @since 3.0.0
*
* @param {[type]} (audioConfig && audioConfig.noAudio) || (!deviceAudio.webAudio && !deviceAudio.audioData) - [description]
*
* @return {[type]} [description]
*/
if ((audioConfig && audioConfig.noAudio) || (!deviceAudio.webAudio && !deviceAudio.audioData)) if ((audioConfig && audioConfig.noAudio) || (!deviceAudio.webAudio && !deviceAudio.audioData))
{ {
console.info('Skipping loading audio \'' + key + '\' since sounds are disabled.'); console.info('Skipping loading audio \'' + key + '\' since sounds are disabled.');
@ -113,68 +103,44 @@ AudioFile.create = function (loader, key, urls, config, xhrSettings)
var url = AudioFile.findAudioURL(game, urls); var url = AudioFile.findAudioURL(game, urls);
/**
* [description]
*
* @method Phaser.Loader.FileTypes.AudioFile#
* @since 3.0.0
*
* @param {[type]} !url - [description]
*
* @return {[type]} [description]
*/
if (!url) if (!url)
{ {
console.warn('No supported url provided for audio \'' + key + '\'!'); console.warn('No supported url provided for audio \'' + key + '\'!');
return null; return null;
} }
/**
* [description]
*
* @method Phaser.Loader.FileTypes.AudioFile#
* @since 3.0.0
*
* @param {[type]} deviceAudio.webAudio && !(audioConfig && audioConfig.disableWebAudio) - [description]
*
* @return {[type]} [description]
*/
if (deviceAudio.webAudio && !(audioConfig && audioConfig.disableWebAudio)) if (deviceAudio.webAudio && !(audioConfig && audioConfig.disableWebAudio))
{ {
return new AudioFile(key, url, loader.path, xhrSettings, game.sound.context); return new AudioFile(key, url, loader.path, xhrSettings, game.sound.context);
} }
/**
* [description]
*
* @method Phaser.Loader.FileTypes.AudioFile#
* @since 3.0.0
*
* @return {[type]} [description]
*/
else else
{ {
return new HTML5AudioFile(key, url, loader.path, config, game.sound.locked); return new HTML5AudioFile(key, url, loader.path, config, game.sound.locked);
} }
}; };
// When registering a factory function 'this' refers to the Loader context. /**
// * Adds an Audio file to the current load queue.
// There are several properties available to use: *
// * Note: This method will only be available if the Audio File type has been built into Phaser.
// this.scene - a reference to the Scene that owns the GameObjectFactory *
* The file is **not** loaded immediately after calling this method.
* Instead, the file is added to a queue within the Loader, which is processed automatically when the Loader starts.
*
* @method Phaser.Loader.LoaderPlugin#audio
* @since 3.0.0
*
* @param {string} key - [description]
* @param {string|string[]} urls - [description]
* @param {object} config - [description]
* @param {object} xhrSettings - [description]
*
* @return {Phaser.Loader.LoaderPlugin} The Loader.
*/
FileTypesManager.register('audio', function (key, urls, config, xhrSettings) FileTypesManager.register('audio', function (key, urls, config, xhrSettings)
{ {
var audioFile = AudioFile.create(this, key, urls, config, xhrSettings); var audioFile = AudioFile.create(this, key, urls, config, xhrSettings);
/**
* [description]
*
* @method Phaser.Loader.FileTypes.AudioFile#
* @since 3.0.0
*
* @param {[type]} audioFile - [description]
*/
if (audioFile) if (audioFile)
{ {
this.addFile(audioFile); this.addFile(audioFile);
@ -229,29 +195,11 @@ FileTypesManager.register('audio', function (key, urls, config, xhrSettings)
AudioFile.findAudioURL = function (game, urls) AudioFile.findAudioURL = function (game, urls)
{ {
/**
* [description]
*
* @method Phaser.Loader.FileTypes.AudioFile#
* @since 3.0.0
*
* @param {[type]} urls.constructor !== Array - [description]
*/
if (urls.constructor !== Array) if (urls.constructor !== Array)
{ {
urls = [ urls ]; urls = [ urls ];
} }
/**
* [description]
*
* @method Phaser.Loader.FileTypes.AudioFile#
* @since 3.0.0
*
* @param {[type]} var i = 0; i < urls.length; i++ - [description]
*
* @return {[type]} [description]
*/
for (var i = 0; i < urls.length; i++) for (var i = 0; i < urls.length; i++)
{ {
var url = GetFastValue(urls[i], 'uri', urls[i]); var url = GetFastValue(urls[i], 'uri', urls[i]);

View file

@ -3,8 +3,26 @@ var CONST = require('../const');
var FileTypesManager = require('../FileTypesManager'); var FileTypesManager = require('../FileTypesManager');
var JSONFile = require('./JSONFile.js'); var JSONFile = require('./JSONFile.js');
// Phaser.Loader.FileTypes.AudioSprite /**
* Adds an Audio Sprite file to the current load queue.
*
* Note: This method will only be available if the Audio Sprite File type has been built into Phaser.
*
* The file is **not** loaded immediately after calling this method.
* Instead, the file is added to a queue within the Loader, which is processed automatically when the Loader starts.
*
* @method Phaser.Loader.LoaderPlugin#audioSprite
* @since 3.0.0
*
* @param {string} key - [description]
* @param {string|string[]} urls - [description]
* @param {object} json - [description]
* @param {object} config - [description]
* @param {object} audioXhrSettings - Optional file specific XHR settings.
* @param {object} jsonXhrSettings - Optional file specific XHR settings.
*
* @return {Phaser.Loader.LoaderPlugin} The Loader.
*/
FileTypesManager.register('audioSprite', function (key, urls, json, config, audioXhrSettings, jsonXhrSettings) FileTypesManager.register('audioSprite', function (key, urls, json, config, audioXhrSettings, jsonXhrSettings)
{ {
var audioFile = AudioFile.create(this, key, urls, config, audioXhrSettings); var audioFile = AudioFile.create(this, key, urls, config, audioXhrSettings);

View file

@ -4,8 +4,21 @@ var File = require('../File');
var FileTypesManager = require('../FileTypesManager'); var FileTypesManager = require('../FileTypesManager');
var GetFastValue = require('../../utils/object/GetFastValue'); var GetFastValue = require('../../utils/object/GetFastValue');
// Phaser.Loader.FileTypes.BinaryFile /**
* @classdesc
* [description]
*
* @class BinaryFile
* @extends Phaser.Loader.File
* @memberOf Phaser.Loader.FileTypes
* @constructor
* @since 3.0.0
*
* @param {string} key - [description]
* @param {string} url - [description]
* @param {string} path - [description]
* @param {object} xhrSettings - [description]
*/
var BinaryFile = new Class({ var BinaryFile = new Class({
Extends: File, Extends: File,
@ -42,12 +55,23 @@ var BinaryFile = new Class({
}); });
// When registering a factory function 'this' refers to the Loader context. /**
// * Adds Binary file to the current load queue.
// There are several properties available to use: *
// * Note: This method will only be available if the Binary File type has been built into Phaser.
// this.scene - a reference to the Scene that owns the GameObjectFactory *
* The file is **not** loaded immediately after calling this method.
* Instead, the file is added to a queue within the Loader, which is processed automatically when the Loader starts.
*
* @method Phaser.Loader.LoaderPlugin#binary
* @since 3.0.0
*
* @param {string} key - [description]
* @param {string} url - [description]
* @param {object} xhrSettings - [description]
*
* @return {Phaser.Loader.LoaderPlugin} The Loader.
*/
FileTypesManager.register('binary', function (key, url, xhrSettings) FileTypesManager.register('binary', function (key, url, xhrSettings)
{ {
if (Array.isArray(key)) if (Array.isArray(key))

View file

@ -2,6 +2,21 @@ var FileTypesManager = require('../FileTypesManager');
var ImageFile = require('./ImageFile.js'); var ImageFile = require('./ImageFile.js');
var XMLFile = require('./XMLFile.js'); var XMLFile = require('./XMLFile.js');
/**
* An Bitmap Font File.
*
* @function Phaser.Loader.Filetypes.BitmapFontFile
* @since 3.0.0
*
* @param {string} key - The key of the file within the loader.
* @param {string} textureURL - The url to load the texture file from.
* @param {string} xmlURL - The url to load the atlas file from.
* @param {string} path - The path of the file.
* @param {object} textureXhrSettings - Optional texture file specific XHR settings.
* @param {object} xmlXhrSettings - Optional atlas file specific XHR settings.
*
* @return {object} An object containing two File objects to be added to the loader.
*/
var BitmapFontFile = function (key, textureURL, xmlURL, path, textureXhrSettings, xmlXhrSettings) var BitmapFontFile = function (key, textureURL, xmlURL, path, textureXhrSettings, xmlXhrSettings)
{ {
var image = new ImageFile(key, textureURL, path, textureXhrSettings); var image = new ImageFile(key, textureURL, path, textureXhrSettings);
@ -18,12 +33,25 @@ var BitmapFontFile = function (key, textureURL, xmlURL, path, textureXhrSettings
return { texture: image, data: data }; return { texture: image, data: data };
}; };
// When registering a factory function 'this' refers to the Loader context. /**
// * Adds a Bitmap Font file to the current load queue.
// There are several properties available to use: *
// * Note: This method will only be available if the Bitmap Font File type has been built into Phaser.
// this.scene - a reference to the Scene that owns the GameObjectFactory *
* The file is **not** loaded immediately after calling this method.
* Instead, the file is added to a queue within the Loader, which is processed automatically when the Loader starts.
*
* @method Phaser.Loader.LoaderPlugin#bitmapFont
* @since 3.0.0
*
* @param {string} key - [description]
* @param {string} textureURL - [description]
* @param {string} xmlURL - [description]
* @param {object} textureXhrSettings - [description]
* @param {object} xmlXhrSettings - [description]
*
* @return {Phaser.Loader.LoaderPlugin} The Loader.
*/
FileTypesManager.register('bitmapFont', function (key, textureURL, xmlURL, textureXhrSettings, xmlXhrSettings) FileTypesManager.register('bitmapFont', function (key, textureURL, xmlURL, textureXhrSettings, xmlXhrSettings)
{ {
// Returns an object with two properties: 'texture' and 'data' // Returns an object with two properties: 'texture' and 'data'

View file

@ -4,8 +4,21 @@ var File = require('../File');
var FileTypesManager = require('../FileTypesManager'); var FileTypesManager = require('../FileTypesManager');
var GetFastValue = require('../../utils/object/GetFastValue'); var GetFastValue = require('../../utils/object/GetFastValue');
// Phaser.Loader.FileTypes.GLSLFile /**
* @classdesc
* [description]
*
* @class GLSLFile
* @extends Phaser.Loader.File
* @memberOf Phaser.Loader.FileTypes
* @constructor
* @since 3.0.0
*
* @param {string} key - [description]
* @param {string} url - [description]
* @param {string} path - [description]
* @param {object} xhrSettings - [description]
*/
var GLSLFile = new Class({ var GLSLFile = new Class({
Extends: File, Extends: File,
@ -42,12 +55,23 @@ var GLSLFile = new Class({
}); });
// When registering a factory function 'this' refers to the Loader context. /**
// * Adds a GLSL file to the current load queue.
// There are several properties available to use: *
// * Note: This method will only be available if the GLSL File type has been built into Phaser.
// this.scene - a reference to the Scene that owns the GameObjectFactory *
* The file is **not** loaded immediately after calling this method.
* Instead, the file is added to a queue within the Loader, which is processed automatically when the Loader starts.
*
* @method Phaser.Loader.LoaderPlugin#glsl
* @since 3.0.0
*
* @param {string} key - [description]
* @param {string} url - [description]
* @param {object} xhrSettings - [description]
*
* @return {Phaser.Loader.LoaderPlugin} The Loader.
*/
FileTypesManager.register('glsl', function (key, url, xhrSettings) FileTypesManager.register('glsl', function (key, url, xhrSettings)
{ {
if (Array.isArray(key)) if (Array.isArray(key))

View file

@ -3,8 +3,22 @@ var File = require('../File');
var GetFastValue = require('../../utils/object/GetFastValue'); var GetFastValue = require('../../utils/object/GetFastValue');
var GetURL = require('../GetURL'); var GetURL = require('../GetURL');
// Phaser.Loader.FileTypes.HTML5AudioFile /**
* @classdesc
* [description]
*
* @class HTML5AudioFile
* @extends Phaser.Loader.File
* @memberOf Phaser.Loader.FileTypes
* @constructor
* @since 3.0.0
*
* @param {string} key - [description]
* @param {string} url - [description]
* @param {string} path - [description]
* @param {object} config - [description]
* @param {boolean} locked - [description]
*/
var HTML5AudioFile = new Class({ var HTML5AudioFile = new Class({
Extends: File, Extends: File,

View file

@ -4,8 +4,23 @@ var File = require('../File');
var FileTypesManager = require('../FileTypesManager'); var FileTypesManager = require('../FileTypesManager');
var GetFastValue = require('../../utils/object/GetFastValue'); var GetFastValue = require('../../utils/object/GetFastValue');
// Phaser.Loader.FileTypes.HTMLFile /**
* @classdesc
* [description]
*
* @class HTMLFile
* @extends Phaser.Loader.File
* @memberOf Phaser.Loader.FileTypes
* @constructor
* @since 3.0.0
*
* @param {string} key - [description]
* @param {string} url - [description]
* @param {number} width - [description]
* @param {number} height - [description]
* @param {string} path - [description]
* @param {object} xhrSettings - [description]
*/
var HTMLFile = new Class({ var HTMLFile = new Class({
Extends: File, Extends: File,
@ -96,12 +111,25 @@ var HTMLFile = new Class({
}); });
// When registering a factory function 'this' refers to the Loader context. /**
// * Adds an HTML file to the current load queue.
// There are several properties available to use: *
// * Note: This method will only be available if the HTML File type has been built into Phaser.
// this.scene - a reference to the Scene that owns the GameObjectFactory *
* The file is **not** loaded immediately after calling this method.
* Instead, the file is added to a queue within the Loader, which is processed automatically when the Loader starts.
*
* @method Phaser.Loader.LoaderPlugin#html
* @since 3.0.0
*
* @param {string} key - [description]
* @param {string} url - [description]
* @param {number} width - [description]
* @param {number} height - [description]
* @param {object} xhrSettings - [description]
*
* @return {Phaser.Loader.LoaderPlugin} The Loader.
*/
FileTypesManager.register('html', function (key, url, width, height, xhrSettings) FileTypesManager.register('html', function (key, url, width, height, xhrSettings)
{ {
if (Array.isArray(key)) if (Array.isArray(key))

View file

@ -4,8 +4,22 @@ var File = require('../File');
var FileTypesManager = require('../FileTypesManager'); var FileTypesManager = require('../FileTypesManager');
var GetFastValue = require('../../utils/object/GetFastValue'); var GetFastValue = require('../../utils/object/GetFastValue');
// Phaser.Loader.FileTypes.ImageFile /**
* @classdesc
* [description]
*
* @class ImageFile
* @extends Phaser.Loader.File
* @memberOf Phaser.Loader.FileTypes
* @constructor
* @since 3.0.0
*
* @param {string} key - [description]
* @param {string} url - [description]
* @param {string} path - [description]
* @param {object} xhrSettings - [description]
* @param {object} config - [description]
*/
var ImageFile = new Class({ var ImageFile = new Class({
Extends: File, Extends: File,
@ -79,25 +93,40 @@ var ImageFile = new Class({
}); });
// When registering a factory function 'this' refers to the Loader context. /**
// * Adds an Image file to the current load queue.
// There are several properties available to use: *
// * Note: This method will only be available if the Image File type has been built into Phaser.
// this.scene - a reference to the Scene that owns the GameObjectFactory *
* The file is **not** loaded immediately after calling this method.
* Instead, the file is added to a queue within the Loader, which is processed automatically when the Loader starts.
*
* @method Phaser.Loader.LoaderPlugin#image
* @since 3.0.0
*
* @param {string} key - [description]
* @param {string} url - [description]
* @param {object} xhrSettings - [description]
*
* @return {Phaser.Loader.LoaderPlugin} The Loader.
*/
FileTypesManager.register('image', function (key, url, xhrSettings) FileTypesManager.register('image', function (key, url, xhrSettings)
{ {
var urls;
var fileA;
var fileB;
if (Array.isArray(key)) if (Array.isArray(key))
{ {
for (var i = 0; i < key.length; i++) for (var i = 0; i < key.length; i++)
{ {
// If it's an array it has to be an array of Objects, so we get everything out of the 'key' object // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object
var urls = GetFastValue(key[i], 'file', url); urls = GetFastValue(key[i], 'file', url);
if (Array.isArray(urls) && urls.length === 2) if (Array.isArray(urls) && urls.length === 2)
{ {
var fileA = this.addFile(new ImageFile(key[i], urls[0], this.path, xhrSettings)); fileA = this.addFile(new ImageFile(key[i], urls[0], this.path, xhrSettings));
var fileB = this.addFile(new ImageFile(key[i], urls[1], this.path, xhrSettings)); fileB = this.addFile(new ImageFile(key[i], urls[1], this.path, xhrSettings));
fileA.setLinkFile(fileB, 'dataimage'); fileA.setLinkFile(fileB, 'dataimage');
} }
@ -109,12 +138,12 @@ FileTypesManager.register('image', function (key, url, xhrSettings)
} }
else else
{ {
var urls = GetFastValue(key, 'file', url); urls = GetFastValue(key, 'file', url);
if (Array.isArray(urls) && urls.length === 2) if (Array.isArray(urls) && urls.length === 2)
{ {
var fileA = this.addFile(new ImageFile(key, urls[0], this.path, xhrSettings)); fileA = this.addFile(new ImageFile(key, urls[0], this.path, xhrSettings));
var fileB = this.addFile(new ImageFile(key, urls[1], this.path, xhrSettings)); fileB = this.addFile(new ImageFile(key, urls[1], this.path, xhrSettings));
fileA.setLinkFile(fileB, 'dataimage'); fileA.setLinkFile(fileB, 'dataimage');
} }

View file

@ -4,8 +4,21 @@ var File = require('../File');
var FileTypesManager = require('../FileTypesManager'); var FileTypesManager = require('../FileTypesManager');
var GetFastValue = require('../../utils/object/GetFastValue'); var GetFastValue = require('../../utils/object/GetFastValue');
// Phaser.Loader.FileTypes.JSONFile /**
* @classdesc
* [description]
*
* @class JSONFile
* @extends Phaser.Loader.File
* @memberOf Phaser.Loader.FileTypes
* @constructor
* @since 3.0.0
*
* @param {string} key - [description]
* @param {string} url - [description]
* @param {string} path - [description]
* @param {object} xhrSettings - [description]
*/
var JSONFile = new Class({ var JSONFile = new Class({
Extends: File, Extends: File,
@ -52,12 +65,23 @@ var JSONFile = new Class({
}); });
// When registering a factory function 'this' refers to the Loader context. /**
// * Adds a JSON file to the current load queue.
// There are several properties available to use: *
// * Note: This method will only be available if the JSON File type has been built into Phaser.
// this.scene - a reference to the Scene that owns the GameObjectFactory *
* The file is **not** loaded immediately after calling this method.
* Instead, the file is added to a queue within the Loader, which is processed automatically when the Loader starts.
*
* @method Phaser.Loader.LoaderPlugin#json
* @since 3.0.0
*
* @param {string} key - [description]
* @param {string} url - [description]
* @param {object} xhrSettings - [description]
*
* @return {Phaser.Loader.LoaderPlugin} The Loader.
*/
FileTypesManager.register('json', function (key, url, xhrSettings) FileTypesManager.register('json', function (key, url, xhrSettings)
{ {
if (Array.isArray(key)) if (Array.isArray(key))

View file

@ -3,8 +3,25 @@ var ImageFile = require('./ImageFile.js');
var JSONFile = require('./JSONFile.js'); var JSONFile = require('./JSONFile.js');
var NumberArray = require('../../utils/array/NumberArray'); var NumberArray = require('../../utils/array/NumberArray');
// Phaser.Loader.FileTypes.MultiAtlas /**
* Adds a Multi File Texture Atlas to the current load queue.
*
* Note: This method will only be available if the Multi Atlas File type has been built into Phaser.
*
* The file is **not** loaded immediately after calling this method.
* Instead, the file is added to a queue within the Loader, which is processed automatically when the Loader starts.
*
* @method Phaser.Loader.LoaderPlugin#multiatlas
* @since 3.0.0
*
* @param {string} key - [description]
* @param {string[]} textureURLs - [description]
* @param {string[]} atlasURLs - [description]
* @param {object} textureXhrSettings - [description]
* @param {object} atlasXhrSettings - [description]
*
* @return {Phaser.Loader.LoaderPlugin} The Loader.
*/
FileTypesManager.register('multiatlas', function (key, textureURLs, atlasURLs, textureXhrSettings, atlasXhrSettings) FileTypesManager.register('multiatlas', function (key, textureURLs, atlasURLs, textureXhrSettings, atlasXhrSettings)
{ {
if (typeof textureURLs === 'number') if (typeof textureURLs === 'number')

View file

@ -5,8 +5,21 @@ var FileTypesManager = require('../FileTypesManager');
var GetFastValue = require('../../utils/object/GetFastValue'); var GetFastValue = require('../../utils/object/GetFastValue');
var PluginManager = require('../../plugins/PluginManager'); var PluginManager = require('../../plugins/PluginManager');
// Phaser.Loader.FileTypes.PluginFile /**
* @classdesc
* [description]
*
* @class PluginFile
* @extends Phaser.Loader.File
* @memberOf Phaser.Loader.FileTypes
* @constructor
* @since 3.0.0
*
* @param {string} key - [description]
* @param {string} url - [description]
* @param {string} path - [description]
* @param {object} xhrSettings - [description]
*/
var PluginFile = new Class({ var PluginFile = new Class({
Extends: File, Extends: File,
@ -52,12 +65,23 @@ var PluginFile = new Class({
}); });
// When registering a factory function 'this' refers to the Loader context. /**
// * Adds a Plugin file to the current load queue.
// There are several properties available to use: *
// * Note: This method will only be available if the Plugin File type has been built into Phaser.
// this.scene - a reference to the Scene that owns the GameObjectFactory *
* The file is **not** loaded immediately after calling this method.
* Instead, the file is added to a queue within the Loader, which is processed automatically when the Loader starts.
*
* @method Phaser.Loader.LoaderPlugin#plugin
* @since 3.0.0
*
* @param {string} key - [description]
* @param {string} url - [description]
* @param {object} xhrSettings - [description]
*
* @return {Phaser.Loader.LoaderPlugin} The Loader.
*/
FileTypesManager.register('plugin', function (key, url, xhrSettings) FileTypesManager.register('plugin', function (key, url, xhrSettings)
{ {
if (Array.isArray(key)) if (Array.isArray(key))

View file

@ -4,8 +4,21 @@ var File = require('../File');
var FileTypesManager = require('../FileTypesManager'); var FileTypesManager = require('../FileTypesManager');
var GetFastValue = require('../../utils/object/GetFastValue'); var GetFastValue = require('../../utils/object/GetFastValue');
// Phaser.Loader.FileTypes.SVGFile /**
* @classdesc
* [description]
*
* @class SVGFile
* @extends Phaser.Loader.File
* @memberOf Phaser.Loader.FileTypes
* @constructor
* @since 3.0.0
*
* @param {string} key - [description]
* @param {string} url - [description]
* @param {string} path - [description]
* @param {object} xhrSettings - [description]
*/
var SVGFile = new Class({ var SVGFile = new Class({
Extends: File, Extends: File,
@ -91,12 +104,23 @@ var SVGFile = new Class({
}); });
// When registering a factory function 'this' refers to the Loader context. /**
// * Adds an SVG file to the current load queue.
// There are several properties available to use: *
// * Note: This method will only be available if the SVG File type has been built into Phaser.
// this.scene - a reference to the Scene that owns the GameObjectFactory *
* The file is **not** loaded immediately after calling this method.
* Instead, the file is added to a queue within the Loader, which is processed automatically when the Loader starts.
*
* @method Phaser.Loader.LoaderPlugin#svg
* @since 3.0.0
*
* @param {string} key - [description]
* @param {string} url - [description]
* @param {object} xhrSettings - [description]
*
* @return {Phaser.Loader.LoaderPlugin} The Loader.
*/
FileTypesManager.register('svg', function (key, url, xhrSettings) FileTypesManager.register('svg', function (key, url, xhrSettings)
{ {
if (Array.isArray(key)) if (Array.isArray(key))

View file

@ -4,8 +4,21 @@ var File = require('../File');
var FileTypesManager = require('../FileTypesManager'); var FileTypesManager = require('../FileTypesManager');
var GetFastValue = require('../../utils/object/GetFastValue'); var GetFastValue = require('../../utils/object/GetFastValue');
// Phaser.Loader.FileTypes.ScriptFile /**
* @classdesc
* [description]
*
* @class ScriptFile
* @extends Phaser.Loader.File
* @memberOf Phaser.Loader.FileTypes
* @constructor
* @since 3.0.0
*
* @param {string} key - [description]
* @param {string} url - [description]
* @param {string} path - [description]
* @param {object} xhrSettings - [description]
*/
var ScriptFile = new Class({ var ScriptFile = new Class({
Extends: File, Extends: File,
@ -48,12 +61,23 @@ var ScriptFile = new Class({
}); });
// When registering a factory function 'this' refers to the Loader context. /**
// * Adds a JavaScript file to the current load queue.
// There are several properties available to use: *
// * Note: This method will only be available if the Script File type has been built into Phaser.
// this.scene - a reference to the Scene that owns the GameObjectFactory *
* The file is **not** loaded immediately after calling this method.
* Instead, the file is added to a queue within the Loader, which is processed automatically when the Loader starts.
*
* @method Phaser.Loader.LoaderPlugin#script
* @since 3.0.0
*
* @param {string} key - [description]
* @param {string} url - [description]
* @param {object} xhrSettings - [description]
*
* @return {Phaser.Loader.LoaderPlugin} The Loader.
*/
FileTypesManager.register('script', function (key, url, xhrSettings) FileTypesManager.register('script', function (key, url, xhrSettings)
{ {
if (Array.isArray(key)) if (Array.isArray(key))

View file

@ -1,42 +0,0 @@
var FileTypesManager = require('../FileTypesManager');
var ImageFile = require('./ImageFile.js');
// config can include: frameWidth, frameHeight, startFrame, endFrame, margin, spacing
var SpriteSheet = function (key, url, config, path, xhrSettings)
{
var image = new ImageFile(key, url, path, xhrSettings, config);
// Override the File type
image.type = 'spritesheet';
return image;
};
// When registering a factory function 'this' refers to the Loader context.
//
// There are several properties available to use:
//
// this.scene - a reference to the Scene that owns the GameObjectFactory
// config can include: frameWidth, frameHeight, startFrame, endFrame, margin, spacing
FileTypesManager.register('spritesheet', function (key, url, config, xhrSettings)
{
if (Array.isArray(key))
{
for (var i = 0; i < key.length; i++)
{
// If it's an array it has to be an array of Objects, so we get everything out of the 'key' object
this.addFile(new SpriteSheet(key[i], url, null, this.path, xhrSettings));
}
}
else
{
this.addFile(new SpriteSheet(key, url, config, this.path, xhrSettings));
}
// For method chaining
return this;
});
module.exports = SpriteSheet;

View file

@ -0,0 +1,65 @@
var FileTypesManager = require('../FileTypesManager');
var ImageFile = require('./ImageFile.js');
/**
* A Sprite Sheet File.
*
* @function Phaser.Loader.Filetypes.SpriteSheetFile
* @since 3.0.0
*
* @param {string} key - The key of the file within the loader.
* @param {string} url - The url to load the texture file from.
* @param {object} config - Optional texture file specific XHR settings.
* @param {string} path - Optional texture file specific XHR settings.
* @param {object} xhrSettings - Optional atlas file specific XHR settings.
*
* @return {object} An object containing two File objects to be added to the loader.
*/
var SpriteSheetFile = function (key, url, config, path, xhrSettings)
{
var image = new ImageFile(key, url, path, xhrSettings, config);
// Override the File type
image.type = 'spritesheet';
return image;
};
/**
* Adds a Sprite Sheet file to the current load queue.
*
* Note: This method will only be available if the Sprite Sheet File type has been built into Phaser.
*
* The file is **not** loaded immediately after calling this method.
* Instead, the file is added to a queue within the Loader, which is processed automatically when the Loader starts.
*
* @method Phaser.Loader.LoaderPlugin#image
* @since 3.0.0
*
* @param {string} key - [description]
* @param {string} url - [description]
* @param {object} config - config can include: frameWidth, frameHeight, startFrame, endFrame, margin, spacing.
* @param {object} xhrSettings - [description]
*
* @return {Phaser.Loader.LoaderPlugin} The Loader.
*/
FileTypesManager.register('spritesheet', function (key, url, config, xhrSettings)
{
if (Array.isArray(key))
{
for (var i = 0; i < key.length; i++)
{
// If it's an array it has to be an array of Objects, so we get everything out of the 'key' object
this.addFile(new SpriteSheetFile(key[i], url, null, this.path, xhrSettings));
}
}
else
{
this.addFile(new SpriteSheetFile(key, url, config, this.path, xhrSettings));
}
// For method chaining
return this;
});
module.exports = SpriteSheetFile;

View file

@ -3,8 +3,21 @@ var CONST = require('../const');
var File = require('../File'); var File = require('../File');
var FileTypesManager = require('../FileTypesManager'); var FileTypesManager = require('../FileTypesManager');
// Phaser.Loader.FileTypes.TextFile /**
* @classdesc
* [description]
*
* @class TextFile
* @extends Phaser.Loader.File
* @memberOf Phaser.Loader.FileTypes
* @constructor
* @since 3.0.0
*
* @param {string} key - [description]
* @param {string} url - [description]
* @param {string} path - [description]
* @param {object} xhrSettings - [description]
*/
var TextFile = new Class({ var TextFile = new Class({
Extends: File, Extends: File,
@ -39,12 +52,23 @@ var TextFile = new Class({
}); });
// When registering a factory function 'this' refers to the Loader context. /**
// * Adds a Text file to the current load queue.
// There are several properties available to use: *
// * Note: This method will only be available if the Text File type has been built into Phaser.
// this.scene - a reference to the Scene that owns the GameObjectFactory *
* The file is **not** loaded immediately after calling this method.
* Instead, the file is added to a queue within the Loader, which is processed automatically when the Loader starts.
*
* @method Phaser.Loader.LoaderPlugin#text
* @since 3.0.0
*
* @param {string} key - [description]
* @param {string} url - [description]
* @param {object} xhrSettings - [description]
*
* @return {Phaser.Loader.LoaderPlugin} The Loader.
*/
FileTypesManager.register('text', function (key, url, xhrSettings) FileTypesManager.register('text', function (key, url, xhrSettings)
{ {
if (Array.isArray(key)) if (Array.isArray(key))

View file

@ -4,8 +4,22 @@ var File = require('../File');
var FileTypesManager = require('../FileTypesManager'); var FileTypesManager = require('../FileTypesManager');
var TILEMAP_FORMATS = require('../../tilemaps/Formats'); var TILEMAP_FORMATS = require('../../tilemaps/Formats');
// Phaser.Loader.FileTypes.TilemapCSVFile /**
* @classdesc
* [description]
*
* @class TilemapCSVFile
* @extends Phaser.Loader.File
* @memberOf Phaser.Loader.FileTypes
* @constructor
* @since 3.0.0
*
* @param {string} key - [description]
* @param {string} url - [description]
* @param {string} path - [description]
* @param {string} format - [description]
* @param {object} xhrSettings - [description]
*/
var TilemapCSVFile = new Class({ var TilemapCSVFile = new Class({
Extends: File, Extends: File,
@ -42,12 +56,23 @@ var TilemapCSVFile = new Class({
}); });
// When registering a factory function 'this' refers to the Loader context. /**
// * Adds a Tilemap CSV file to the current load queue.
// There are several properties available to use: *
// * Note: This method will only be available if the Tilemap CSV File type has been built into Phaser.
// this.scene - a reference to the Scene that owns the GameObjectFactory *
* The file is **not** loaded immediately after calling this method.
* Instead, the file is added to a queue within the Loader, which is processed automatically when the Loader starts.
*
* @method Phaser.Loader.LoaderPlugin#tilemapCSV
* @since 3.0.0
*
* @param {string} key - [description]
* @param {string} url - [description]
* @param {object} xhrSettings - [description]
*
* @return {Phaser.Loader.LoaderPlugin} The Loader.
*/
FileTypesManager.register('tilemapCSV', function (key, url, xhrSettings) FileTypesManager.register('tilemapCSV', function (key, url, xhrSettings)
{ {
if (Array.isArray(key)) if (Array.isArray(key))

View file

@ -2,8 +2,20 @@ var FileTypesManager = require('../FileTypesManager');
var JSONFile = require('./JSONFile.js'); var JSONFile = require('./JSONFile.js');
var TILEMAP_FORMATS = require('../../tilemaps/Formats'); var TILEMAP_FORMATS = require('../../tilemaps/Formats');
// Phaser.Loader.FileTypes.TilemapJSONFile /**
* A Tilemap File.
*
* @function Phaser.Loader.Filetypes.TilemapJSONFile
* @since 3.0.0
*
* @param {string} key - [description]
* @param {string} url - [description]
* @param {string} path - [description]
* @param {string} format - [description]
* @param {object} xhrSettings - [description]
*
* @return {object} An object containing two File objects to be added to the loader.
*/
var TilemapJSONFile = function (key, url, path, format, xhrSettings) var TilemapJSONFile = function (key, url, path, format, xhrSettings)
{ {
var json = new JSONFile(key, url, path, xhrSettings); var json = new JSONFile(key, url, path, xhrSettings);
@ -16,12 +28,23 @@ var TilemapJSONFile = function (key, url, path, format, xhrSettings)
return json; return json;
}; };
// When registering a factory function 'this' refers to the Loader context. /**
// * Adds a Tilemap (Tiled JSON Format) file to the current load queue.
// There are several properties available to use: *
// * Note: This method will only be available if the Tilemap File type has been built into Phaser.
// this.scene - a reference to the Scene that owns the GameObjectFactory *
* The file is **not** loaded immediately after calling this method.
* Instead, the file is added to a queue within the Loader, which is processed automatically when the Loader starts.
*
* @method Phaser.Loader.LoaderPlugin#tilemapTiledJSON
* @since 3.0.0
*
* @param {string} key - [description]
* @param {string} url - [description]
* @param {object} xhrSettings - [description]
*
* @return {Phaser.Loader.LoaderPlugin} The Loader.
*/
FileTypesManager.register('tilemapTiledJSON', function (key, url, xhrSettings) FileTypesManager.register('tilemapTiledJSON', function (key, url, xhrSettings)
{ {
if (Array.isArray(key)) if (Array.isArray(key))
@ -41,6 +64,23 @@ FileTypesManager.register('tilemapTiledJSON', function (key, url, xhrSettings)
return this; return this;
}); });
/**
* Adds a Tilemap (Weltmeister Format) file to the current load queue.
*
* Note: This method will only be available if the Tilemap File type has been built into Phaser.
*
* The file is **not** loaded immediately after calling this method.
* Instead, the file is added to a queue within the Loader, which is processed automatically when the Loader starts.
*
* @method Phaser.Loader.LoaderPlugin#tilemapWeltmeister
* @since 3.0.0
*
* @param {string} key - [description]
* @param {string} url - [description]
* @param {object} xhrSettings - [description]
*
* @return {Phaser.Loader.LoaderPlugin} The Loader.
*/
FileTypesManager.register('tilemapWeltmeister', function (key, url, xhrSettings) FileTypesManager.register('tilemapWeltmeister', function (key, url, xhrSettings)
{ {
if (Array.isArray(key)) if (Array.isArray(key))

View file

@ -2,6 +2,21 @@ var FileTypesManager = require('../FileTypesManager');
var ImageFile = require('./ImageFile.js'); var ImageFile = require('./ImageFile.js');
var TextFile = require('./TextFile.js'); var TextFile = require('./TextFile.js');
/**
* An Atlas JSON File.
*
* @function Phaser.Loader.Filetypes.UnityAtlasFile
* @since 3.0.0
*
* @param {string} key - The key of the file within the loader.
* @param {string} textureURL - The url to load the texture file from.
* @param {string} atlasURL - The url to load the atlas file from.
* @param {string} path - The path of the file.
* @param {object} textureXhrSettings - Optional texture file specific XHR settings.
* @param {object} atlasXhrSettings - Optional atlas file specific XHR settings.
*
* @return {object} An object containing two File objects to be added to the loader.
*/
var UnityAtlasFile = function (key, textureURL, atlasURL, path, textureXhrSettings, atlasXhrSettings) var UnityAtlasFile = function (key, textureURL, atlasURL, path, textureXhrSettings, atlasXhrSettings)
{ {
var image = new ImageFile(key, textureURL, path, textureXhrSettings); var image = new ImageFile(key, textureURL, path, textureXhrSettings);
@ -18,12 +33,25 @@ var UnityAtlasFile = function (key, textureURL, atlasURL, path, textureXhrSettin
return { texture: image, data: data }; return { texture: image, data: data };
}; };
// When registering a factory function 'this' refers to the Loader context. /**
// * Adds a Unity Texture Atlas file to the current load queue.
// There are several properties available to use: *
// * Note: This method will only be available if the Unity Atlas File type has been built into Phaser.
// this.scene - a reference to the Scene that owns the GameObjectFactory *
* The file is **not** loaded immediately after calling this method.
* Instead, the file is added to a queue within the Loader, which is processed automatically when the Loader starts.
*
* @method Phaser.Loader.LoaderPlugin#unityAtlas
* @since 3.0.0
*
* @param {string} key - The key of the file within the loader.
* @param {string} textureURL - The url to load the texture file from.
* @param {string} atlasURL - The url to load the atlas file from.
* @param {object} textureXhrSettings - Optional texture file specific XHR settings.
* @param {object} atlasXhrSettings - Optional atlas file specific XHR settings.
*
* @return {Phaser.Loader.LoaderPlugin} The Loader.
*/
FileTypesManager.register('unityAtlas', function (key, textureURL, atlasURL, textureXhrSettings, atlasXhrSettings) FileTypesManager.register('unityAtlas', function (key, textureURL, atlasURL, textureXhrSettings, atlasXhrSettings)
{ {
// Returns an object with two properties: 'texture' and 'data' // Returns an object with two properties: 'texture' and 'data'

View file

@ -5,8 +5,21 @@ var FileTypesManager = require('../FileTypesManager');
var GetFastValue = require('../../utils/object/GetFastValue'); var GetFastValue = require('../../utils/object/GetFastValue');
var ParseOBJ = require('../../geom/mesh/ParseOBJ'); var ParseOBJ = require('../../geom/mesh/ParseOBJ');
// Phaser.Loader.FileTypes.WavefrontFile /**
* @classdesc
* [description]
*
* @class WavefrontFile
* @extends Phaser.Loader.File
* @memberOf Phaser.Loader.FileTypes
* @constructor
* @since 3.0.0
*
* @param {string} key - [description]
* @param {string} url - [description]
* @param {string} path - [description]
* @param {object} xhrSettings - [description]
*/
var WavefrontFile = new Class({ var WavefrontFile = new Class({
Extends: File, Extends: File,
@ -43,12 +56,23 @@ var WavefrontFile = new Class({
}); });
// When registering a factory function 'this' refers to the Loader context. /**
// * Adds a Wavefront OBK file to the current load queue.
// There are several properties available to use: *
// * Note: This method will only be available if the file type has been built into Phaser.
// this.scene - a reference to the Scene that owns the GameObjectFactory *
* The file is **not** loaded immediately after calling this method.
* Instead, the file is added to a queue within the Loader, which is processed automatically when the Loader starts.
*
* @method Phaser.Loader.LoaderPlugin#obj
* @since 3.0.0
*
* @param {string} key - [description]
* @param {string} url - [description]
* @param {object} xhrSettings - [description]
*
* @return {Phaser.Loader.LoaderPlugin} The Loader.
*/
FileTypesManager.register('obj', function (key, url, xhrSettings) FileTypesManager.register('obj', function (key, url, xhrSettings)
{ {
if (Array.isArray(key)) if (Array.isArray(key))

View file

@ -5,8 +5,21 @@ var FileTypesManager = require('../FileTypesManager');
var GetFastValue = require('../../utils/object/GetFastValue'); var GetFastValue = require('../../utils/object/GetFastValue');
var ParseXML = require('../../dom/ParseXML'); var ParseXML = require('../../dom/ParseXML');
// Phaser.Loader.FileTypes.XMLFile /**
* @classdesc
* [description]
*
* @class XMLFile
* @extends Phaser.Loader.File
* @memberOf Phaser.Loader.FileTypes
* @constructor
* @since 3.0.0
*
* @param {string} key - [description]
* @param {string} url - [description]
* @param {string} path - [description]
* @param {object} xhrSettings - [description]
*/
var XMLFile = new Class({ var XMLFile = new Class({
Extends: File, Extends: File,
@ -48,12 +61,23 @@ var XMLFile = new Class({
}); });
// When registering a factory function 'this' refers to the Loader context. /**
// * Adds an XML file to the current load queue.
// There are several properties available to use: *
// * Note: This method will only be available if the XML File type has been built into Phaser.
// this.scene - a reference to the Scene that owns the GameObjectFactory *
* The file is **not** loaded immediately after calling this method.
* Instead, the file is added to a queue within the Loader, which is processed automatically when the Loader starts.
*
* @method Phaser.Loader.LoaderPlugin#xml
* @since 3.0.0
*
* @param {string} key - [description]
* @param {string} url - [description]
* @param {object} xhrSettings - [description]
*
* @return {Phaser.Loader.LoaderPlugin} The Loader.
*/
FileTypesManager.register('xml', function (key, url, xhrSettings) FileTypesManager.register('xml', function (key, url, xhrSettings)
{ {
if (Array.isArray(key)) if (Array.isArray(key))

View file

@ -41,7 +41,7 @@ module.exports = {
MultiAtlas: require('./MultiAtlas'), MultiAtlas: require('./MultiAtlas'),
PluginFile: require('./PluginFile'), PluginFile: require('./PluginFile'),
ScriptFile: require('./ScriptFile'), ScriptFile: require('./ScriptFile'),
SpriteSheet: require('./SpriteSheet'), SpriteSheetFile: require('./SpriteSheetFile'),
SVGFile: require('./SVGFile'), SVGFile: require('./SVGFile'),
TextFile: require('./TextFile'), TextFile: require('./TextFile'),
TilemapCSVFile: require('./TilemapCSVFile'), TilemapCSVFile: require('./TilemapCSVFile'),

View file

@ -59,10 +59,10 @@ var Body = new Class({
this.enabled = true; this.enabled = true;
/** /**
* [description] * The ImpactBody, ImpactSprite or ImpactImage object that owns this Body, if any.
* *
* @name Phaser.Physics.Impact.Body#parent * @name Phaser.Physics.Impact.Body#parent
* @type {null} * @type {Phaser.Physics.Impact.ImpactBody|Phaser.Physics.Impact.ImpactImage|Phaser.Physics.Impact.ImpactSprite|null}
* @since 3.0.0 * @since 3.0.0
*/ */
this.parent; this.parent;
@ -505,7 +505,7 @@ var Body = new Class({
* [description] * [description]
* *
* @method Phaser.Physics.Impact.Body#fromJSON * @method Phaser.Physics.Impact.Body#fromJSON
* @todo * @todo Code it!
* @since 3.0.0 * @since 3.0.0
* *
* @param {object} config - [description] * @param {object} config - [description]

View file

@ -1,8 +1,18 @@
// Phaser.Physics.Impact.CollisionMap
var Class = require('../../utils/Class'); var Class = require('../../utils/Class');
var DefaultDefs = require('./DefaultDefs'); var DefaultDefs = require('./DefaultDefs');
/**
* @classdesc
* [description]
*
* @class CollisionMap
* @memberOf Phaser.Physics.Impact
* @constructor
* @since 3.0.0
*
* @param {integer} [tilesize=32] - [description]
* @param {array} data - [description]
*/
var CollisionMap = new Class({ var CollisionMap = new Class({
initialize: initialize:
@ -11,18 +21,78 @@ var CollisionMap = new Class({
{ {
if (tilesize === undefined) { tilesize = 32; } if (tilesize === undefined) { tilesize = 32; }
/**
* [description]
*
* @name Phaser.Physics.Impact.CollisionMap#tilesize
* @type {integer}
* @default 32
* @since 3.0.0
*/
this.tilesize = tilesize; this.tilesize = tilesize;
/**
* [description]
*
* @name Phaser.Physics.Impact.CollisionMap#data
* @type {array}
* @since 3.0.0
*/
this.data = (Array.isArray(data)) ? data : []; this.data = (Array.isArray(data)) ? data : [];
/**
* [description]
*
* @name Phaser.Physics.Impact.CollisionMap#width
* @type {number}
* @since 3.0.0
*/
this.width = (Array.isArray(data)) ? data[0].length : 0; this.width = (Array.isArray(data)) ? data[0].length : 0;
/**
* [description]
*
* @name Phaser.Physics.Impact.CollisionMap#height
* @type {number}
* @since 3.0.0
*/
this.height = (Array.isArray(data)) ? data.length : 0; this.height = (Array.isArray(data)) ? data.length : 0;
/**
* [description]
*
* @name Phaser.Physics.Impact.CollisionMap#lastSlope
* @type {integer}
* @default 55
* @since 3.0.0
*/
this.lastSlope = 55; this.lastSlope = 55;
/**
* [description]
*
* @name Phaser.Physics.Impact.CollisionMap#tiledef
* @type {object}
* @since 3.0.0
*/
this.tiledef = DefaultDefs; this.tiledef = DefaultDefs;
}, },
/**
* [description]
*
* @method Phaser.Physics.Impact.CollisionMap#trace
* @since 3.0.0
*
* @param {number} x - [description]
* @param {number} y - [description]
* @param {number} vx - [description]
* @param {number} vy - [description]
* @param {number} objectWidth - [description]
* @param {number} objectHeight - [description]
*
* @return {boolean} [description]
*/
trace: function (x, y, vx, vy, objectWidth, objectHeight) trace: function (x, y, vx, vy, objectWidth, objectHeight)
{ {
// Set up the trace-result // Set up the trace-result
@ -77,6 +147,23 @@ var CollisionMap = new Class({
return res; return res;
}, },
/**
* [description]
*
* @method Phaser.Physics.Impact.CollisionMap#step
* @since 3.0.0
*
* @param {object} res - [description]
* @param {number} x - [description]
* @param {number} y - [description]
* @param {number} vx - [description]
* @param {number} vy - [description]
* @param {number} width - [description]
* @param {number} height - [description]
* @param {number} rvx - [description]
* @param {number} rvy - [description]
* @param {number} step - [description]
*/
step: function (res, x, y, vx, vy, width, height, rvx, rvy, step) step: function (res, x, y, vx, vy, width, height, rvx, rvy, step)
{ {
var t = 0; var t = 0;
@ -191,6 +278,25 @@ var CollisionMap = new Class({
} }
}, },
/**
* [description]
*
* @method Phaser.Physics.Impact.CollisionMap#checkDef
* @since 3.0.0
*
* @param {object} res - [description]
* @param {number} t - [description]
* @param {number} x - [description]
* @param {number} y - [description]
* @param {number} vx - [description]
* @param {number} vy - [description]
* @param {number} width - [description]
* @param {number} height - [description]
* @param {number} tileX - [description]
* @param {number} tileY - [description]
*
* @return {boolean} [description]
*/
checkDef: function (res, t, x, y, vx, vy, width, height, tileX, tileY) checkDef: function (res, t, x, y, vx, vy, width, height, tileX, tileY)
{ {
var def = this.tiledef[t]; var def = this.tiledef[t];

View file

@ -3,22 +3,71 @@ var ImpactBody = require('./ImpactBody');
var ImpactImage = require('./ImpactImage'); var ImpactImage = require('./ImpactImage');
var ImpactSprite = require('./ImpactSprite'); var ImpactSprite = require('./ImpactSprite');
/**
* @classdesc
* The Impact Physics Factory allows you to easily create Impact Physics enabled Game Objects.
* Objects that are created by this Factory are automatically added to the physics world.
*
* @class Factory
* @memberOf Phaser.Physics.Impact
* @constructor
* @since 3.0.0
*
* @param {Phaser.Physics.Impact.World} world - [description]
*/
var Factory = new Class({ var Factory = new Class({
initialize: initialize:
function Factory (world) function Factory (world)
{ {
/**
* [description]
*
* @name Phaser.Physics.Impact.Factory#world
* @type {Phaser.Physics.Impact.World}
* @since 3.0.0
*/
this.world = world; this.world = world;
/**
* A reference to the Scene.Systems this Impact Physics instance belongs to.
*
* @name Phaser.Physics.Impact.Factory#sys
* @type {Phaser.Scenes.Systems}
* @since 3.0.0
*/
this.sys = world.scene.sys; this.sys = world.scene.sys;
}, },
/**
* [description]
*
* @method Phaser.Physics.Impact.Factory#body
* @since 3.0.0
*
* @param {number} x - [description]
* @param {number} y - [description]
* @param {number} width - [description]
* @param {number} height - [description]
*
* @return {Phaser.Physics.Impact.ImpactBody} The ImpactBody object that was created.
*/
body: function (x, y, width, height) body: function (x, y, width, height)
{ {
return new ImpactBody(this.world, x, y, width, height); return new ImpactBody(this.world, x, y, width, height);
}, },
/**
* Adds an Impact Physics Body to the given Game Object.
*
* @method Phaser.Physics.Impact.Factory#existing
* @since 3.0.0
*
* @param {Phaser.GameObjects.GameObject} gameObject - [description]
*
* @return {Phaser.GameObjects.GameObject} The Game Object.
*/
existing: function (gameObject) existing: function (gameObject)
{ {
var x = gameObject.x - gameObject.frame.centerX; var x = gameObject.x - gameObject.frame.centerX;
@ -34,6 +83,19 @@ var Factory = new Class({
return gameObject; return gameObject;
}, },
/**
* [description]
*
* @method Phaser.Physics.Impact.Factory#image
* @since 3.0.0
*
* @param {number} x - The horizontal position of this Game Object in the world.
* @param {number} y - The vertical position of this Game Object in the world.
* @param {string} texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager.
* @param {string|integer} [frame] - An optional frame from the Texture this Game Object is rendering with.
*
* @return {Phaser.Physics.Impact.ImpactImage} The ImpactImage object that was created.
*/
image: function (x, y, key, frame) image: function (x, y, key, frame)
{ {
var image = new ImpactImage(this.world, x, y, key, frame); var image = new ImpactImage(this.world, x, y, key, frame);
@ -43,6 +105,19 @@ var Factory = new Class({
return image; return image;
}, },
/**
* [description]
*
* @method Phaser.Physics.Impact.Factory#sprite
* @since 3.0.0
*
* @param {number} x - The horizontal position of this Game Object in the world.
* @param {number} y - The vertical position of this Game Object in the world.
* @param {string} texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager.
* @param {string|integer} [frame] - An optional frame from the Texture this Game Object is rendering with.
*
* @return {Phaser.Physics.Impact.ImpactSprite} The ImpactSprite object that was created.
*/
sprite: function (x, y, key, frame) sprite: function (x, y, key, frame)
{ {
var sprite = new ImpactSprite(this.world, x, y, key, frame); var sprite = new ImpactSprite(this.world, x, y, key, frame);

View file

@ -1,5 +1,19 @@
var Clamp = require('../../math/Clamp'); var Clamp = require('../../math/Clamp');
/**
* [description]
*
* @function Phaser.Physics.Impact.GetVelocity
* @since 3.0.0
*
* @param {number} delta - [description]
* @param {number} vel - [description]
* @param {number} accel - [description]
* @param {number} friction - [description]
* @param {number} max - [description]
*
* @return {number} [description]
*/
var GetVelocity = function (delta, vel, accel, friction, max) var GetVelocity = function (delta, vel, accel, friction, max)
{ {
if (accel) if (accel)

View file

@ -1,7 +1,34 @@
var Class = require('../../utils/Class'); var Class = require('../../utils/Class');
var Components = require('./components'); var Components = require('./components');
/**
* @classdesc
* [description]
*
* @class ImpactBody
* @memberOf Phaser.Physics.Impact
* @constructor
* @since 3.0.0
*
* @extends Phaser.Physics.Impact.Components.Acceleration
* @extends Phaser.Physics.Impact.Components.BodyScale
* @extends Phaser.Physics.Impact.Components.BodyType
* @extends Phaser.Physics.Impact.Components.Bounce
* @extends Phaser.Physics.Impact.Components.CheckAgainst
* @extends Phaser.Physics.Impact.Components.Collides
* @extends Phaser.Physics.Impact.Components.Debug
* @extends Phaser.Physics.Impact.Components.Friction
* @extends Phaser.Physics.Impact.Components.Gravity
* @extends Phaser.Physics.Impact.Components.Offset
* @extends Phaser.Physics.Impact.Components.SetGameObject
* @extends Phaser.Physics.Impact.Components.Velocity
*
* @param {Phaser.Physics.Impact.World} world - [description]
* @param {number} x - [description]
* @param {number} y - [description]
* @param {number} width - [description]
* @param {number} height - [description]
*/
var ImpactBody = new Class({ var ImpactBody = new Class({
Mixins: [ Mixins: [
@ -21,19 +48,71 @@ var ImpactBody = new Class({
initialize: initialize:
// x/y is the top-left of the Body
function ImpactBody (world, x, y, width, height) function ImpactBody (world, x, y, width, height)
{ {
/**
* [description]
*
* @name Phaser.Physics.Impact.ImpactBody#body
* @type {Phaser.Physics.Impact.Body}
* @since 3.0.0
*/
this.body = world.create(x, y, width, height); this.body = world.create(x, y, width, height);
this.body.parent = this; this.body.parent = this;
// Local references to the Body properties /**
* [description]
*
* @name Phaser.Physics.Impact.ImpactBody#size
* @type {{x: number, y: number}}
* @since 3.0.0
*/
this.size = this.body.size; this.size = this.body.size;
/**
* [description]
*
* @name Phaser.Physics.Impact.ImpactBody#offset
* @type {{x: number, y: number}}
* @since 3.0.0
*/
this.offset = this.body.offset; this.offset = this.body.offset;
/**
* [description]
*
* @name Phaser.Physics.Impact.ImpactBody#vel
* @type {{x: number, y: number}}
* @since 3.0.0
*/
this.vel = this.body.vel; this.vel = this.body.vel;
/**
* [description]
*
* @name Phaser.Physics.Impact.ImpactBody#accel
* @type {{x: number, y: number}}
* @since 3.0.0
*/
this.accel = this.body.accel; this.accel = this.body.accel;
/**
* [description]
*
* @name Phaser.Physics.Impact.ImpactBody#friction
* @type {{x: number, y: number}}
* @since 3.0.0
*/
this.friction = this.body.friction; this.friction = this.body.friction;
/**
* [description]
*
* @name Phaser.Physics.Impact.ImpactBody#maxVel
* @type {{x: number, y: number}}
* @since 3.0.0
*/
this.maxVel = this.body.maxVel; this.maxVel = this.body.maxVel;
} }

View file

@ -1,8 +1,55 @@
var Class = require('../../utils/Class'); var Class = require('../../utils/Class');
var Components = require('./components'); var Components = require('./components');
var Image = require('../../gameobjects/image/Image'); var Image = require('../../gameobjects/image/Image');
/**
* @classdesc
* An Impact Physics Image Game Object.
*
* An Image is a light-weight Game Object useful for the display of static images in your game,
* such as logos, backgrounds, scenery or other non-animated elements. Images can have input
* events and physics bodies, or be tweened, tinted or scrolled. The main difference between an
* Image and a Sprite is that you cannot animate an Image as they do not have the Animation component.
*
* @class ImpactImage
* @extends Phaser.GameObjects.Image
* @memberOf Phaser.Physics.Impact
* @constructor
* @since 3.0.0
*
* @extends Phaser.Physics.Impact.Components.Acceleration
* @extends Phaser.Physics.Impact.Components.BodyScale
* @extends Phaser.Physics.Impact.Components.BodyType
* @extends Phaser.Physics.Impact.Components.Bounce
* @extends Phaser.Physics.Impact.Components.CheckAgainst
* @extends Phaser.Physics.Impact.Components.Collides
* @extends Phaser.Physics.Impact.Components.Debug
* @extends Phaser.Physics.Impact.Components.Friction
* @extends Phaser.Physics.Impact.Components.Gravity
* @extends Phaser.Physics.Impact.Components.Offset
* @extends Phaser.Physics.Impact.Components.SetGameObject
* @extends Phaser.Physics.Impact.Components.Velocity
* @extends Phaser.GameObjects.Components.Alpha
* @extends Phaser.GameObjects.Components.BlendMode
* @extends Phaser.GameObjects.Components.Depth
* @extends Phaser.GameObjects.Components.Flip
* @extends Phaser.GameObjects.Components.GetBounds
* @extends Phaser.GameObjects.Components.Origin
* @extends Phaser.GameObjects.Components.Pipeline
* @extends Phaser.GameObjects.Components.ScaleMode
* @extends Phaser.GameObjects.Components.ScrollFactor
* @extends Phaser.GameObjects.Components.Size
* @extends Phaser.GameObjects.Components.Texture
* @extends Phaser.GameObjects.Components.Tint
* @extends Phaser.GameObjects.Components.Transform
* @extends Phaser.GameObjects.Components.Visible
*
* @param {Phaser.Physics.Impact.World} world - [description]
* @param {number} x - The horizontal position of this Game Object in the world.
* @param {number} y - The vertical position of this Game Object in the world.
* @param {string} texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager.
* @param {string|integer} [frame] - An optional frame from the Texture this Game Object is rendering with.
*/
var ImpactImage = new Class({ var ImpactImage = new Class({
Extends: Image, Extends: Image,
@ -24,22 +71,74 @@ var ImpactImage = new Class({
initialize: initialize:
// x/y is the center of the Image / Body, just like other default Game Objects
function ImpactImage (world, x, y, texture, frame) function ImpactImage (world, x, y, texture, frame)
{ {
Image.call(this, world.scene, x, y, texture, frame); Image.call(this, world.scene, x, y, texture, frame);
/**
* [description]
*
* @name Phaser.Physics.Impact.ImpactImage#body
* @type {Phaser.Physics.Impact.Body}
* @since 3.0.0
*/
this.body = world.create(x - this.frame.centerX, y - this.frame.centerY, this.width, this.height); this.body = world.create(x - this.frame.centerX, y - this.frame.centerY, this.width, this.height);
this.body.parent = this; this.body.parent = this;
this.body.gameObject = this; this.body.gameObject = this;
// Local references to the Body properties /**
* [description]
*
* @name Phaser.Physics.Impact.ImpactImage#size
* @type {{x: number, y: number}}
* @since 3.0.0
*/
this.size = this.body.size; this.size = this.body.size;
/**
* [description]
*
* @name Phaser.Physics.Impact.ImpactImage#offset
* @type {{x: number, y: number}}
* @since 3.0.0
*/
this.offset = this.body.offset; this.offset = this.body.offset;
/**
* [description]
*
* @name Phaser.Physics.Impact.ImpactImage#vel
* @type {{x: number, y: number}}
* @since 3.0.0
*/
this.vel = this.body.vel; this.vel = this.body.vel;
/**
* [description]
*
* @name Phaser.Physics.Impact.ImpactImage#accel
* @type {{x: number, y: number}}
* @since 3.0.0
*/
this.accel = this.body.accel; this.accel = this.body.accel;
/**
* [description]
*
* @name Phaser.Physics.Impact.ImpactImage#friction
* @type {{x: number, y: number}}
* @since 3.0.0
*/
this.friction = this.body.friction; this.friction = this.body.friction;
/**
* [description]
*
* @name Phaser.Physics.Impact.ImpactImage#maxVel
* @type {{x: number, y: number}}
* @since 3.0.0
*/
this.maxVel = this.body.maxVel; this.maxVel = this.body.maxVel;
} }

View file

@ -5,17 +5,39 @@ var Merge = require('../../utils/object/Merge');
var PluginManager = require('../../plugins/PluginManager'); var PluginManager = require('../../plugins/PluginManager');
var World = require('./World'); var World = require('./World');
// Phaser.Physics.Impact.ImpactPhysics /**
* @classdesc
* [description]
*
* @class ImpactPhysics
* @memberOf Phaser.Physics.Impact
* @constructor
* @since 3.0.0
*
* @param {Phaser.Scene} scene - [description]
*/
var ImpactPhysics = new Class({ var ImpactPhysics = new Class({
initialize: initialize:
function ImpactPhysics (scene) function ImpactPhysics (scene)
{ {
// The Scene that owns this plugin /**
* [description]
*
* @name Phaser.Physics.Impact.ImpactPhysics#scene
* @type {Phaser.Scene}
* @since 3.0.0
*/
this.scene = scene; this.scene = scene;
/**
* [description]
*
* @name Phaser.Physics.Impact.ImpactPhysics#systems
* @type {Phaser.Scenes.Systems}
* @since 3.0.0
*/
this.systems = scene.sys; this.systems = scene.sys;
if (!scene.sys.settings.isBooted) if (!scene.sys.settings.isBooted)
@ -23,13 +45,42 @@ var ImpactPhysics = new Class({
scene.sys.events.once('boot', this.boot, this); scene.sys.events.once('boot', this.boot, this);
} }
/**
* [description]
*
* @name Phaser.Physics.Impact.ImpactPhysics#config
* @type {object}
* @since 3.0.0
*/
this.config = this.getConfig(); this.config = this.getConfig();
/**
* [description]
*
* @name Phaser.Physics.Impact.ImpactPhysics#world
* @type {Phaser.Physics.Impact.World}
* @since 3.0.0
*/
this.world; this.world;
/**
* [description]
*
* @name Phaser.Physics.Impact.ImpactPhysics#add
* @type {Phaser.Physics.Impact.Factory}
* @since 3.0.0
*/
this.add; this.add;
}, },
/**
* [description]
*
* @method Phaser.Physics.Impact.ImpactPhysics#getConfig
* @since 3.0.0
*
* @return {object} [description]
*/
getConfig: function () getConfig: function ()
{ {
var gameConfig = this.systems.game.config.physics; var gameConfig = this.systems.game.config.physics;
@ -43,6 +94,12 @@ var ImpactPhysics = new Class({
return config; return config;
}, },
/**
* [description]
*
* @method Phaser.Physics.Impact.ImpactPhysics#boot
* @since 3.0.0
*/
boot: function () boot: function ()
{ {
this.world = new World(this.scene, this.config); this.world = new World(this.scene, this.config);
@ -55,11 +112,49 @@ var ImpactPhysics = new Class({
eventEmitter.on('destroy', this.destroy, this); eventEmitter.on('destroy', this.destroy, this);
}, },
/**
* [description]
*
* @method Phaser.Physics.Impact.ImpactPhysics#pause
* @since 3.0.0
*
* @return {[type]} [description]
*/
pause: function ()
{
return this.world.pause();
},
/**
* [description]
*
* @method Phaser.Physics.Impact.ImpactPhysics#resume
* @since 3.0.0
*
* @return {[type]} [description]
*/
resume: function ()
{
return this.world.resume();
},
/**
* [description]
*
* @method Phaser.Physics.Impact.ImpactPhysics#shutdown
* @since 3.0.0
*/
shutdown: function () shutdown: function ()
{ {
this.world.shutdown(); this.world.shutdown();
}, },
/**
* [description]
*
* @method Phaser.Physics.Impact.ImpactPhysics#destroy
* @since 3.0.0
*/
destroy: function () destroy: function ()
{ {
this.world.destroy(); this.world.destroy();

View file

@ -1,8 +1,59 @@
var Class = require('../../utils/Class'); var Class = require('../../utils/Class');
var Components = require('./components'); var Components = require('./components');
var Sprite = require('../../gameobjects/sprite/Sprite'); var Sprite = require('../../gameobjects/sprite/Sprite');
/**
* @classdesc
* An Impact Physics Sprite Game Object.
*
* A Sprite Game Object is used for the display of both static and animated images in your game.
* Sprites can have input events and physics bodies. They can also be tweened, tinted, scrolled
* and animated.
*
* The main difference between a Sprite and an Image Game Object is that you cannot animate Images.
* As such, Sprites take a fraction longer to process and have a larger API footprint due to the Animation
* Component. If you do not require animation then you can safely use Images to replace Sprites in all cases.
*
* @class ImpactSprite
* @extends Phaser.GameObjects.Sprite
* @memberOf Phaser.Physics.Impact
* @constructor
* @since 3.0.0
*
* @extends Phaser.Physics.Impact.Components.Acceleration
* @extends Phaser.Physics.Impact.Components.BodyScale
* @extends Phaser.Physics.Impact.Components.BodyType
* @extends Phaser.Physics.Impact.Components.Bounce
* @extends Phaser.Physics.Impact.Components.CheckAgainst
* @extends Phaser.Physics.Impact.Components.Collides
* @extends Phaser.Physics.Impact.Components.Debug
* @extends Phaser.Physics.Impact.Components.Friction
* @extends Phaser.Physics.Impact.Components.Gravity
* @extends Phaser.Physics.Impact.Components.Offset
* @extends Phaser.Physics.Impact.Components.SetGameObject
* @extends Phaser.Physics.Impact.Components.Velocity
* @extends Phaser.GameObjects.Components.Alpha
* @extends Phaser.GameObjects.Components.Animation
* @extends Phaser.GameObjects.Components.BlendMode
* @extends Phaser.GameObjects.Components.Depth
* @extends Phaser.GameObjects.Components.Flip
* @extends Phaser.GameObjects.Components.GetBounds
* @extends Phaser.GameObjects.Components.Origin
* @extends Phaser.GameObjects.Components.Pipeline
* @extends Phaser.GameObjects.Components.ScaleMode
* @extends Phaser.GameObjects.Components.ScrollFactor
* @extends Phaser.GameObjects.Components.Size
* @extends Phaser.GameObjects.Components.Texture
* @extends Phaser.GameObjects.Components.Tint
* @extends Phaser.GameObjects.Components.Transform
* @extends Phaser.GameObjects.Components.Visible
*
* @param {Phaser.Physics.Impact.World} world - [description]
* @param {number} x - The horizontal position of this Game Object in the world.
* @param {number} y - The vertical position of this Game Object in the world.
* @param {string} texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager.
* @param {string|integer} [frame] - An optional frame from the Texture this Game Object is rendering with.
*/
var ImpactSprite = new Class({ var ImpactSprite = new Class({
Extends: Sprite, Extends: Sprite,
@ -24,22 +75,74 @@ var ImpactSprite = new Class({
initialize: initialize:
// x/y is the center of the Sprite / Body, just like other default Game Objects
function ImpactSprite (world, x, y, texture, frame) function ImpactSprite (world, x, y, texture, frame)
{ {
Sprite.call(this, world.scene, x, y, texture, frame); Sprite.call(this, world.scene, x, y, texture, frame);
/**
* [description]
*
* @name Phaser.Physics.Impact.ImpactSprite#body
* @type {Phaser.Physics.Impact.Body}
* @since 3.0.0
*/
this.body = world.create(x - this.frame.centerX, y - this.frame.centerY, this.width, this.height); this.body = world.create(x - this.frame.centerX, y - this.frame.centerY, this.width, this.height);
this.body.parent = this; this.body.parent = this;
this.body.gameObject = this; this.body.gameObject = this;
// Local references to the Body properties /**
* [description]
*
* @name Phaser.Physics.Impact.ImpactSprite#size
* @type {{x: number, y: number}}
* @since 3.0.0
*/
this.size = this.body.size; this.size = this.body.size;
/**
* [description]
*
* @name Phaser.Physics.Impact.ImpactSprite#offset
* @type {{x: number, y: number}}
* @since 3.0.0
*/
this.offset = this.body.offset; this.offset = this.body.offset;
/**
* [description]
*
* @name Phaser.Physics.Impact.ImpactSprite#vel
* @type {{x: number, y: number}}
* @since 3.0.0
*/
this.vel = this.body.vel; this.vel = this.body.vel;
/**
* [description]
*
* @name Phaser.Physics.Impact.ImpactSprite#accel
* @type {{x: number, y: number}}
* @since 3.0.0
*/
this.accel = this.body.accel; this.accel = this.body.accel;
/**
* [description]
*
* @name Phaser.Physics.Impact.ImpactSprite#friction
* @type {{x: number, y: number}}
* @since 3.0.0
*/
this.friction = this.body.friction; this.friction = this.body.friction;
/**
* [description]
*
* @name Phaser.Physics.Impact.ImpactSprite#maxVel
* @type {{x: number, y: number}}
* @since 3.0.0
*/
this.maxVel = this.body.maxVel; this.maxVel = this.body.maxVel;
} }

View file

@ -1,9 +1,17 @@
var COLLIDES = require('./COLLIDES');
var SeperateX = require('./SeperateX'); var SeperateX = require('./SeperateX');
var SeperateY = require('./SeperateY'); var SeperateY = require('./SeperateY');
var COLLIDES = require('./COLLIDES');
// Impact Physics Solver
/**
* Impact Physics Solver
*
* @function Phaser.Physics.Impact.Solver
* @since 3.0.0
*
* @param {Phaser.Physics.Impact.World} world - [description]
* @param {Phaser.Physics.Impact.Body} bodyA - [description]
* @param {Phaser.Physics.Impact.Body} bodyB - [description]
*/
var Solver = function (world, bodyA, bodyB) var Solver = function (world, bodyA, bodyB)
{ {
var weak = null; var weak = null;

View file

@ -1,10 +1,17 @@
// Set up the trace-result /**
// var res = { * Set up the trace-result
// collision: {x: false, y: false, slope: false}, * var res = {
// pos: {x: x, y: y}, * collision: {x: false, y: false, slope: false},
// tile: {x: 0, y: 0} * pos: {x: x, y: y},
// }; * tile: {x: 0, y: 0}
* };
*
* @function Phaser.Physics.Impact.UpdateMotion
* @since 3.0.0
*
* @param {Phaser.Physics.Impact.Body} body - [description]
* @param {object} res - [description]
*/
var UpdateMotion = function (body, res) var UpdateMotion = function (body, res)
{ {
body.standing = false; body.standing = false;

View file

@ -1,18 +1,28 @@
// Phaser.Physics.Impact.World
var Body = require('./Body'); var Body = require('./Body');
var Class = require('../../utils/Class'); var Class = require('../../utils/Class');
var COLLIDES = require('./COLLIDES'); var COLLIDES = require('./COLLIDES');
var CollisionMap = require('./CollisionMap'); var CollisionMap = require('./CollisionMap');
var EventEmitter = require('eventemitter3'); var EventEmitter = require('eventemitter3');
var GetFastValue = require('../../utils/object/GetFastValue'); var GetFastValue = require('../../utils/object/GetFastValue');
var HasValue = require('../../utils/object/HasValue');
var Set = require('../../structs/Set'); var Set = require('../../structs/Set');
var Solver = require('./Solver'); var Solver = require('./Solver');
var TYPE = require('./TYPE');
var TILEMAP_FORMATS = require('../../tilemaps/Formats'); var TILEMAP_FORMATS = require('../../tilemaps/Formats');
var HasValue = require('../../utils/object/HasValue'); var TYPE = require('./TYPE');
var GetFastValue = require('../../utils/object/GetFastValue');
/**
* @classdesc
* [description]
*
* @class World
* @extends Phaser.Physics.Impact.EventEmitter
* @memberOf Phaser.Physics.Impact
* @constructor
* @since 3.0.0
*
* @param {Phaser.Scene} scene - [description]
* @param {object} config - [description]
*/
var World = new Class({ var World = new Class({
Extends: EventEmitter, Extends: EventEmitter,
@ -23,30 +33,110 @@ var World = new Class({
{ {
EventEmitter.call(this); EventEmitter.call(this);
/**
* [description]
*
* @name Phaser.Physics.Impact.World#scene
* @type {Phaser.Scene}
* @since 3.0.0
*/
this.scene = scene; this.scene = scene;
/**
* [description]
*
* @name Phaser.Physics.Impact.World#bodies
* @type {Phaser.Structs.Set}
* @since 3.0.0
*/
this.bodies = new Set(); this.bodies = new Set();
/**
* [description]
*
* @name Phaser.Physics.Impact.World#gravity
* @type {number}
* @default 0
* @since 3.0.0
*/
this.gravity = GetFastValue(config, 'gravity', 0); this.gravity = GetFastValue(config, 'gravity', 0);
// Spatial hash cell dimensions /**
* Spatial hash cell dimensions
*
* @name Phaser.Physics.Impact.World#cellSize
* @type {integer}
* @default 64
* @since 3.0.0
*/
this.cellSize = GetFastValue(config, 'cellSize', 64); this.cellSize = GetFastValue(config, 'cellSize', 64);
/**
* [description]
*
* @name Phaser.Physics.Impact.World#collisionMap
* @type {Phaser.Physics.Impact.CollisionMap}
* @since 3.0.0
*/
this.collisionMap = new CollisionMap(); this.collisionMap = new CollisionMap();
/**
* [description]
*
* @name Phaser.Physics.Impact.World#timeScale
* @type {float}
* @default 1
* @since 3.0.0
*/
this.timeScale = GetFastValue(config, 'timeScale', 1); this.timeScale = GetFastValue(config, 'timeScale', 1);
// Impacts maximum time step is 20 fps. /**
* Impacts maximum time step is 20 fps.
*
* @name Phaser.Physics.Impact.World#maxStep
* @type {number}
* @default 0.05
* @since 3.0.0
*/
this.maxStep = GetFastValue(config, 'maxStep', 0.05); this.maxStep = GetFastValue(config, 'maxStep', 0.05);
/**
* [description]
*
* @name Phaser.Physics.Impact.World#enabled
* @type {boolean}
* @default true
* @since 3.0.0
*/
this.enabled = true; this.enabled = true;
/**
* [description]
*
* @name Phaser.Physics.Impact.World#drawDebug
* @type {boolean}
* @since 3.0.0
*/
this.drawDebug = GetFastValue(config, 'debug', false); this.drawDebug = GetFastValue(config, 'debug', false);
/**
* [description]
*
* @name Phaser.Physics.Impact.World#debugGraphic
* @type {Phaser.GameObjects.Graphics}
* @since 3.0.0
*/
this.debugGraphic; this.debugGraphic;
var _maxVelocity = GetFastValue(config, 'maxVelocity', 100); var _maxVelocity = GetFastValue(config, 'maxVelocity', 100);
/**
* [description]
*
* @name Phaser.Physics.Impact.World#defaults
* @type {object}
* @since 3.0.0
*/
this.defaults = { this.defaults = {
debugShowBody: GetFastValue(config, 'debugShowBody', true), debugShowBody: GetFastValue(config, 'debugShowBody', true),
debugShowVelocity: GetFastValue(config, 'debugShowVelocity', true), debugShowVelocity: GetFastValue(config, 'debugShowVelocity', true),
@ -60,12 +150,33 @@ var World = new Class({
}; };
/** /**
* @property {object} walls - An object containing the 4 wall bodies that bound the physics world. * An object containing the 4 wall bodies that bound the physics world.
*
* @name Phaser.Physics.Impact.World#walls
* @type {object}
* @since 3.0.0
*/ */
this.walls = { left: null, right: null, top: null, bottom: null }; this.walls = { left: null, right: null, top: null, bottom: null };
/**
* [description]
*
* @name Phaser.Physics.Impact.World#delta
* @type {number}
* @default 0
* @since 3.0.0
*/
this.delta = 0; this.delta = 0;
/**
* [description]
*
* @name Phaser.Physics.Impact.World#_lastId
* @type {number}
* @private
* @default 0
* @since 3.0.0
*/
this._lastId = 0; this._lastId = 0;
if (GetFastValue(config, 'setBounds', false)) if (GetFastValue(config, 'setBounds', false))
@ -102,10 +213,14 @@ var World = new Class({
* Sets the collision map for the world either from a Weltmeister JSON level in the cache or from * Sets the collision map for the world either from a Weltmeister JSON level in the cache or from
* a 2D array. If loading from a Weltmeister level, the map must have a layer called "collision". * a 2D array. If loading from a Weltmeister level, the map must have a layer called "collision".
* *
* @method Phaser.Physics.Impact.World#setCollisionMap
* @since 3.0.0
*
* @param {string|integer[][]} key - Either a string key that corresponds to a Weltmeister level * @param {string|integer[][]} key - Either a string key that corresponds to a Weltmeister level
* in the cache, or a 2D array of collision IDs. * in the cache, or a 2D array of collision IDs.
* @param {integer} tileSize - The size of a tile. This is optional if loading from a Weltmeister * @param {integer} tileSize - The size of a tile. This is optional if loading from a Weltmeister
* level in the cache. * level in the cache.
*
* @return {CollisionMap|null} The newly created CollisionMap, or null if the method failed to * @return {CollisionMap|null} The newly created CollisionMap, or null if the method failed to
* create the CollisionMap. * create the CollisionMap.
*/ */
@ -154,6 +269,9 @@ var World = new Class({
* ways. The easiest is to use Tiled and the slopeTileProperty option. Alternatively, you can * ways. The easiest is to use Tiled and the slopeTileProperty option. Alternatively, you can
* manually create a slopeMap that stores the mapping between tile indices and slope IDs. * manually create a slopeMap that stores the mapping between tile indices and slope IDs.
* *
* @method Phaser.Physics.Impact.World#setCollisionMapFromTilemapLayer
* @since 3.0.0
*
* @param {StaticTilemapLayer|DynamicTilemapLayer} tilemapLayer - The tilemap layer to use. * @param {StaticTilemapLayer|DynamicTilemapLayer} tilemapLayer - The tilemap layer to use.
* @param {object} [options] - Options for controlling the mapping from tiles to slope IDs. * @param {object} [options] - Options for controlling the mapping from tiles to slope IDs.
* @param {string} [options.slopeTileProperty=null] - Slope IDs can be stored on tiles directly * @param {string} [options.slopeTileProperty=null] - Slope IDs can be stored on tiles directly
@ -165,7 +283,8 @@ var World = new Class({
* assign to a colliding tile. If not specified, the tile's index is used. * assign to a colliding tile. If not specified, the tile's index is used.
* @param {integer} [options.defaultNonCollidingSlope=0] - The default slope ID to assign to a * @param {integer} [options.defaultNonCollidingSlope=0] - The default slope ID to assign to a
* non-colliding tile. * non-colliding tile.
* @return {CollisionMap} The newly created CollisionMap. *
* @return {Phaser.Physics.Impact.CollisionMap} The newly created CollisionMap.
*/ */
setCollisionMapFromTilemapLayer: function (tilemapLayer, options) setCollisionMapFromTilemapLayer: function (tilemapLayer, options)
{ {
@ -226,15 +345,20 @@ var World = new Class({
* the newly created bounds will also not have the left and right walls. * the newly created bounds will also not have the left and right walls.
* Explicitly state them in the parameters to override this. * Explicitly state them in the parameters to override this.
* *
* @method Phaser.Physics.P2#setBounds * @method Phaser.Physics.Impact.World#setBounds
* @param {number} x - The x coordinate of the top-left corner of the bounds. * @since 3.0.0
* @param {number} y - The y coordinate of the top-left corner of the bounds. *
* @param {number} width - The width of the bounds. * @param {number} [x] - The x coordinate of the top-left corner of the bounds.
* @param {number} height - The height of the bounds. * @param {number} [y] - The y coordinate of the top-left corner of the bounds.
* @param {number} [width] - The width of the bounds.
* @param {number} [height] - The height of the bounds.
* @param {number} [thickness=64] - [description]
* @param {boolean} [left=true] - If true will create the left bounds wall. * @param {boolean} [left=true] - If true will create the left bounds wall.
* @param {boolean} [right=true] - If true will create the right bounds wall. * @param {boolean} [right=true] - If true will create the right bounds wall.
* @param {boolean} [top=true] - If true will create the top bounds wall. * @param {boolean} [top=true] - If true will create the top bounds wall.
* @param {boolean} [bottom=true] - If true will create the bottom bounds wall. * @param {boolean} [bottom=true] - If true will create the bottom bounds wall.
*
* @return {Phaser.Physics.Impact.World} This World object.
*/ */
setBounds: function (x, y, width, height, thickness, left, right, top, bottom) setBounds: function (x, y, width, height, thickness, left, right, top, bottom)
{ {
@ -256,7 +380,19 @@ var World = new Class({
return this; return this;
}, },
// position = 'left', 'right', 'top' or 'bottom' /**
* position = 'left', 'right', 'top' or 'bottom'
*
* @method Phaser.Physics.Impact.World#updateWall
* @since 3.0.0
*
* @param {boolean} add - [description]
* @param {string} position - [description]
* @param {number} x - [description]
* @param {number} y - [description]
* @param {number} width - [description]
* @param {number} height - [description]
*/
updateWall: function (add, position, x, y, width, height) updateWall: function (add, position, x, y, width, height)
{ {
var wall = this.walls[position]; var wall = this.walls[position];
@ -286,11 +422,19 @@ var World = new Class({
} }
}, },
/**
* [description]
*
* @method Phaser.Physics.Impact.World#createDebugGraphic
* @since 3.0.0
*
* @return {Phaser.GameObjects.Graphics} [description]
*/
createDebugGraphic: function () createDebugGraphic: function ()
{ {
var graphic = this.scene.sys.add.graphics({ x: 0, y: 0 }); var graphic = this.scene.sys.add.graphics({ x: 0, y: 0 });
graphic.setZ(Number.MAX_VALUE); graphic.setDepth(Number.MAX_VALUE);
this.debugGraphic = graphic; this.debugGraphic = graphic;
@ -299,11 +443,32 @@ var World = new Class({
return graphic; return graphic;
}, },
/**
* [description]
*
* @method Phaser.Physics.Impact.World#getNextID
* @since 3.0.0
*
* @return {integer} [description]
*/
getNextID: function () getNextID: function ()
{ {
return this._lastId++; return this._lastId++;
}, },
/**
* [description]
*
* @method Phaser.Physics.Impact.World#create
* @since 3.0.0
*
* @param {number} x - [description]
* @param {number} y - [description]
* @param {number} sizeX - [description]
* @param {number} sizeY - [description]
*
* @return {Phaser.Physics.Impact.Body} The Body that was added to this World.
*/
create: function (x, y, sizeX, sizeY) create: function (x, y, sizeX, sizeY)
{ {
var body = new Body(this, x, y, sizeX, sizeY); var body = new Body(this, x, y, sizeX, sizeY);
@ -313,25 +478,62 @@ var World = new Class({
return body; return body;
}, },
/**
* [description]
*
* @method Phaser.Physics.Impact.World#remove
* @since 3.0.0
*
* @param {Phaser.Physics.Impact.Body} object - The Body to remove from this World.
*/
remove: function (object) remove: function (object)
{ {
this.bodies.delete(object); this.bodies.delete(object);
}, },
/**
* [description]
*
* @method Phaser.Physics.Impact.World#pause
* @since 3.0.0
*
* @return {Phaser.Physics.Impact.World} This World object.
*/
pause: function () pause: function ()
{ {
this.enabled = false; this.enabled = false;
this.emit('pause');
return this; return this;
}, },
/**
* [description]
*
* @method Phaser.Physics.Impact.World#resume
* @since 3.0.0
*
* @return {Phaser.Physics.Impact.World} This World object.
*/
resume: function () resume: function ()
{ {
this.enabled = true; this.enabled = true;
this.emit('resume');
return this; return this;
}, },
/**
* [description]
*
* @method Phaser.Physics.Impact.World#update
* @since 3.0.0
*
* @param {number} time - [description]
* @param {number} delta - [description]
*/
update: function (time, delta) update: function (time, delta)
{ {
if (!this.enabled || this.bodies.size === 0) if (!this.enabled || this.bodies.size === 0)
@ -394,7 +596,16 @@ var World = new Class({
} }
}, },
// Check the body against the spatial hash /**
* Check the body against the spatial hash.
*
* @method Phaser.Physics.Impact.World#checkHash
* @since 3.0.0
*
* @param {Phaser.Physics.Impact.Body} body - [description]
* @param {object} hash - [description]
* @param {number} size - [description]
*/
checkHash: function (body, hash, size) checkHash: function (body, hash, size)
{ {
var checked = {}; var checked = {};
@ -437,6 +648,15 @@ var World = new Class({
} }
}, },
/**
* [description]
*
* @method Phaser.Physics.Impact.World#checkBodies
* @since 3.0.0
*
* @param {Phaser.Physics.Impact.Body} bodyA - [description]
* @param {Phaser.Physics.Impact.Body} bodyB - [description]
*/
checkBodies: function (bodyA, bodyB) checkBodies: function (bodyA, bodyB)
{ {
// 2 fixed bodies won't do anything // 2 fixed bodies won't do anything
@ -462,10 +682,16 @@ var World = new Class({
} }
}, },
// //////////// /**
// Helpers // * [description]
// //////////// *
* @method Phaser.Physics.Impact.World#setCollidesNever
* @since 3.0.0
*
* @param {Phaser.Physics.Impact.Body[]} bodies - An Array of Impact Bodies to set the collides value on.
*
* @return {Phaser.Physics.Impact.World} This World object.
*/
setCollidesNever: function (bodies) setCollidesNever: function (bodies)
{ {
for (var i = 0; i < bodies.length; i++) for (var i = 0; i < bodies.length; i++)
@ -476,6 +702,16 @@ var World = new Class({
return this; return this;
}, },
/**
* [description]
*
* @method Phaser.Physics.Impact.World#setLite
* @since 3.0.0
*
* @param {Phaser.Physics.Impact.Body[]} bodies - An Array of Impact Bodies to set the collides value on.
*
* @return {Phaser.Physics.Impact.World} This World object.
*/
setLite: function (bodies) setLite: function (bodies)
{ {
for (var i = 0; i < bodies.length; i++) for (var i = 0; i < bodies.length; i++)
@ -486,6 +722,16 @@ var World = new Class({
return this; return this;
}, },
/**
* [description]
*
* @method Phaser.Physics.Impact.World#setPassive
* @since 3.0.0
*
* @param {Phaser.Physics.Impact.Body[]} bodies - An Array of Impact Bodies to set the collides value on.
*
* @return {Phaser.Physics.Impact.World} This World object.
*/
setPassive: function (bodies) setPassive: function (bodies)
{ {
for (var i = 0; i < bodies.length; i++) for (var i = 0; i < bodies.length; i++)
@ -496,6 +742,16 @@ var World = new Class({
return this; return this;
}, },
/**
* [description]
*
* @method Phaser.Physics.Impact.World#setActive
* @since 3.0.0
*
* @param {Phaser.Physics.Impact.Body[]} bodies - An Array of Impact Bodies to set the collides value on.
*
* @return {Phaser.Physics.Impact.World} This World object.
*/
setActive: function (bodies) setActive: function (bodies)
{ {
for (var i = 0; i < bodies.length; i++) for (var i = 0; i < bodies.length; i++)
@ -506,6 +762,16 @@ var World = new Class({
return this; return this;
}, },
/**
* [description]
*
* @method Phaser.Physics.Impact.World#setFixed
* @since 3.0.0
*
* @param {Phaser.Physics.Impact.Body[]} bodies - An Array of Impact Bodies to set the collides value on.
*
* @return {Phaser.Physics.Impact.World} This World object.
*/
setFixed: function (bodies) setFixed: function (bodies)
{ {
for (var i = 0; i < bodies.length; i++) for (var i = 0; i < bodies.length; i++)
@ -516,6 +782,16 @@ var World = new Class({
return this; return this;
}, },
/**
* [description]
*
* @method Phaser.Physics.Impact.World#setTypeNone
* @since 3.0.0
*
* @param {Phaser.Physics.Impact.Body[]} bodies - An Array of Impact Bodies to set the type value on.
*
* @return {Phaser.Physics.Impact.World} This World object.
*/
setTypeNone: function (bodies) setTypeNone: function (bodies)
{ {
for (var i = 0; i < bodies.length; i++) for (var i = 0; i < bodies.length; i++)
@ -526,6 +802,16 @@ var World = new Class({
return this; return this;
}, },
/**
* [description]
*
* @method Phaser.Physics.Impact.World#setTypeA
* @since 3.0.0
*
* @param {Phaser.Physics.Impact.Body[]} bodies - An Array of Impact Bodies to set the type value on.
*
* @return {Phaser.Physics.Impact.World} This World object.
*/
setTypeA: function (bodies) setTypeA: function (bodies)
{ {
for (var i = 0; i < bodies.length; i++) for (var i = 0; i < bodies.length; i++)
@ -536,6 +822,16 @@ var World = new Class({
return this; return this;
}, },
/**
* [description]
*
* @method Phaser.Physics.Impact.World#setTypeB
* @since 3.0.0
*
* @param {Phaser.Physics.Impact.Body[]} bodies - An Array of Impact Bodies to set the type value on.
*
* @return {Phaser.Physics.Impact.World} This World object.
*/
setTypeB: function (bodies) setTypeB: function (bodies)
{ {
for (var i = 0; i < bodies.length; i++) for (var i = 0; i < bodies.length; i++)
@ -546,6 +842,16 @@ var World = new Class({
return this; return this;
}, },
/**
* [description]
*
* @method Phaser.Physics.Impact.World#setAvsB
* @since 3.0.0
*
* @param {Phaser.Physics.Impact.Body[]} bodies - An Array of Impact Bodies to set the type value on.
*
* @return {Phaser.Physics.Impact.World} This World object.
*/
setAvsB: function (bodies) setAvsB: function (bodies)
{ {
for (var i = 0; i < bodies.length; i++) for (var i = 0; i < bodies.length; i++)
@ -557,6 +863,16 @@ var World = new Class({
return this; return this;
}, },
/**
* [description]
*
* @method Phaser.Physics.Impact.World#setBvsA
* @since 3.0.0
*
* @param {Phaser.Physics.Impact.Body[]} bodies - An Array of Impact Bodies to set the type value on.
*
* @return {Phaser.Physics.Impact.World} This World object.
*/
setBvsA: function (bodies) setBvsA: function (bodies)
{ {
for (var i = 0; i < bodies.length; i++) for (var i = 0; i < bodies.length; i++)
@ -568,6 +884,16 @@ var World = new Class({
return this; return this;
}, },
/**
* [description]
*
* @method Phaser.Physics.Impact.World#setCheckAgainstNone
* @since 3.0.0
*
* @param {Phaser.Physics.Impact.Body[]} bodies - An Array of Impact Bodies to set the type value on.
*
* @return {Phaser.Physics.Impact.World} This World object.
*/
setCheckAgainstNone: function (bodies) setCheckAgainstNone: function (bodies)
{ {
for (var i = 0; i < bodies.length; i++) for (var i = 0; i < bodies.length; i++)
@ -578,6 +904,16 @@ var World = new Class({
return this; return this;
}, },
/**
* [description]
*
* @method Phaser.Physics.Impact.World#setCheckAgainstA
* @since 3.0.0
*
* @param {Phaser.Physics.Impact.Body[]} bodies - An Array of Impact Bodies to set the type value on.
*
* @return {Phaser.Physics.Impact.World} This World object.
*/
setCheckAgainstA: function (bodies) setCheckAgainstA: function (bodies)
{ {
for (var i = 0; i < bodies.length; i++) for (var i = 0; i < bodies.length; i++)
@ -588,6 +924,16 @@ var World = new Class({
return this; return this;
}, },
/**
* [description]
*
* @method Phaser.Physics.Impact.World#setCheckAgainstB
* @since 3.0.0
*
* @param {Phaser.Physics.Impact.Body[]} bodies - An Array of Impact Bodies to set the type value on.
*
* @return {Phaser.Physics.Impact.World} This World object.
*/
setCheckAgainstB: function (bodies) setCheckAgainstB: function (bodies)
{ {
for (var i = 0; i < bodies.length; i++) for (var i = 0; i < bodies.length; i++)
@ -598,11 +944,23 @@ var World = new Class({
return this; return this;
}, },
/**
* [description]
*
* @method Phaser.Physics.Impact.World#shutdown
* @since 3.0.0
*/
shutdown: function () shutdown: function ()
{ {
this.removeAllListeners(); this.removeAllListeners();
}, },
/**
* [description]
*
* @method Phaser.Physics.Impact.World#destroy
* @since 3.0.0
*/
destroy: function () destroy: function ()
{ {
this.removeAllListeners(); this.removeAllListeners();

View file

@ -1,38 +1,212 @@
var Class = require('../../utils/Class'); var Class = require('../../utils/Class');
var Utils = require('./Utils'); var Utils = require('./Utils');
/**
* @classdesc
* [description]
*
* @class WebGLPipeline
* @memberOf Phaser.Renderer.WebGL
* @constructor
* @since 3.0.0
*
* @param {object} config - [description]
*/
var WebGLPipeline = new Class({ var WebGLPipeline = new Class({
initialize: initialize:
function WebGLPipeline (config) function WebGLPipeline (config)
{ {
/**
* [description]
*
* @name Phaser.Renderer.WebGL.WebGLPipeline#name
* @type {string}
* @since 3.0.0
*/
this.name = 'WebGLPipeline'; this.name = 'WebGLPipeline';
/**
* [description]
*
* @name Phaser.Renderer.WebGL.WebGLPipeline#game
* @type {Phaser.Game}
* @since 3.0.0
*/
this.game = config.game; this.game = config.game;
/**
* [description]
*
* @name Phaser.Renderer.WebGL.WebGLPipeline#view
* @type {HTMLCanvasElement}
* @since 3.0.0
*/
this.view = config.game.canvas; this.view = config.game.canvas;
/**
* [description]
*
* @name Phaser.Renderer.WebGL.WebGLPipeline#resolution
* @type {number}
* @since 3.0.0
*/
this.resolution = config.game.config.resolution; this.resolution = config.game.config.resolution;
/**
* [description]
*
* @name Phaser.Renderer.WebGL.WebGLPipeline#width
* @type {number}
* @since 3.0.0
*/
this.width = config.game.config.width * this.resolution; this.width = config.game.config.width * this.resolution;
/**
* [description]
*
* @name Phaser.Renderer.WebGL.WebGLPipeline#height
* @type {number}
* @since 3.0.0
*/
this.height = config.game.config.height * this.resolution; this.height = config.game.config.height * this.resolution;
/**
* [description]
*
* @name Phaser.Renderer.WebGL.WebGLPipeline#gl
* @type {[type]}
* @since 3.0.0
*/
this.gl = config.gl; this.gl = config.gl;
/**
* [description]
*
* @name Phaser.Renderer.WebGL.WebGLPipeline#vertexCount
* @type {number}
* @default 0
* @since 3.0.0
*/
this.vertexCount = 0; this.vertexCount = 0;
/**
* [description]
*
* @name Phaser.Renderer.WebGL.WebGLPipeline#vertexCapacity
* @type {integer}
* @since 3.0.0
*/
this.vertexCapacity = config.vertexCapacity; this.vertexCapacity = config.vertexCapacity;
/**
* [description]
*
* @name Phaser.Renderer.WebGL.WebGLPipeline#renderer
* @type {Phaser.Renderer.WebGL.WebGLRenderer}
* @since 3.0.0
*/
this.renderer = config.renderer; this.renderer = config.renderer;
/**
* [description]
*
* @name Phaser.Renderer.WebGL.WebGLPipeline#vertexData
* @type {[type]}
* @since 3.0.0
*/
this.vertexData = (config.vertices ? config.vertices : new ArrayBuffer(config.vertexCapacity * config.vertexSize)); this.vertexData = (config.vertices ? config.vertices : new ArrayBuffer(config.vertexCapacity * config.vertexSize));
/**
* [description]
*
* @name Phaser.Renderer.WebGL.WebGLPipeline#vertexBuffer
* @type {[type]}
* @since 3.0.0
*/
this.vertexBuffer = this.renderer.createVertexBuffer((config.vertices ? config.vertices : this.vertexData.byteLength), this.gl.STREAM_DRAW); this.vertexBuffer = this.renderer.createVertexBuffer((config.vertices ? config.vertices : this.vertexData.byteLength), this.gl.STREAM_DRAW);
/**
* [description]
*
* @name Phaser.Renderer.WebGL.WebGLPipeline#program
* @type {[type]}
* @since 3.0.0
*/
this.program = this.renderer.createProgram(config.vertShader, config.fragShader); this.program = this.renderer.createProgram(config.vertShader, config.fragShader);
/**
* [description]
*
* @name Phaser.Renderer.WebGL.WebGLPipeline#attributes
* @type {[type]}
* @since 3.0.0
*/
this.attributes = config.attributes; this.attributes = config.attributes;
/**
* [description]
*
* @name Phaser.Renderer.WebGL.WebGLPipeline#vertexSize
* @type {[type]}
* @since 3.0.0
*/
this.vertexSize = config.vertexSize; this.vertexSize = config.vertexSize;
/**
* [description]
*
* @name Phaser.Renderer.WebGL.WebGLPipeline#topology
* @type {[type]}
* @since 3.0.0
*/
this.topology = config.topology; this.topology = config.topology;
/**
* [description]
*
* @name Phaser.Renderer.WebGL.WebGLPipeline#bytes
* @type {Uint8Array}
* @since 3.0.0
*/
this.bytes = new Uint8Array(this.vertexData); this.bytes = new Uint8Array(this.vertexData);
// This will store the amount of components of 32 bit length
/**
* This will store the amount of components of 32 bit length
*
* @name Phaser.Renderer.WebGL.WebGLPipeline#vertexComponentCount
* @type {[type]}
* @since 3.0.0
*/
this.vertexComponentCount = Utils.getComponentCount(config.attributes); this.vertexComponentCount = Utils.getComponentCount(config.attributes);
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.WebGLPipeline#shouldFlush
* @since 3.0.0
*
* @return {boolean} [description]
*/
shouldFlush: function () shouldFlush: function ()
{ {
return this.vertexCount >= this.vertexCapacity; return (this.vertexCount >= this.vertexCapacity);
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.WebGLPipeline#resize
* @since 3.0.0
*
* @param {number} width - [description]
* @param {number} height - [description]
* @param {number} resolution - [description]
*
* @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
*/
resize: function (width, height, resolution) resize: function (width, height, resolution)
{ {
this.width = width * resolution; this.width = width * resolution;
@ -40,6 +214,14 @@ var WebGLPipeline = new Class({
return this; return this;
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.WebGLPipeline#bind
* @since 3.0.0
*
* @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
*/
bind: function () bind: function ()
{ {
var gl = this.gl; var gl = this.gl;
@ -71,30 +253,73 @@ var WebGLPipeline = new Class({
return this; return this;
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.WebGLPipeline#onBind
* @since 3.0.0
*
* @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
*/
onBind: function () onBind: function ()
{ {
// This is for updating uniform data it's called on each bind attempt. // This is for updating uniform data it's called on each bind attempt.
return this; return this;
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.WebGLPipeline#onPreRender
* @since 3.0.0
*
* @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
*/
onPreRender: function () onPreRender: function ()
{ {
// called once every frame // called once every frame
return this; return this;
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.WebGLPipeline#onRender
* @since 3.0.0
*
* @param {Phaser.Scene} scene - [description]
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
*
* @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
*/
onRender: function (scene, camera) onRender: function (scene, camera)
{ {
// called for each camera // called for each camera
return this; return this;
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.WebGLPipeline#onPostRender
* @since 3.0.0
*
* @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
*/
onPostRender: function () onPostRender: function ()
{ {
// called once every frame // called once every frame
return this; return this;
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.WebGLPipeline#flush
* @since 3.0.0
*
* @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
*/
flush: function () flush: function ()
{ {
var gl = this.gl; var gl = this.gl;
@ -114,6 +339,14 @@ var WebGLPipeline = new Class({
return this; return this;
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.WebGLPipeline#destroy
* @since 3.0.0
*
* @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
*/
destroy: function () destroy: function ()
{ {
var gl = this.gl; var gl = this.gl;

File diff suppressed because it is too large Load diff

View file

@ -1,9 +1,23 @@
var Class = require('../../../utils/Class'); var Class = require('../../../utils/Class');
var WebGLPipeline = require('../WebGLPipeline');
var Utils = require('../Utils');
var ShaderSourceVS = require('../shaders/BitmapMask.vert');
var ShaderSourceFS = require('../shaders/BitmapMask.frag'); var ShaderSourceFS = require('../shaders/BitmapMask.frag');
var ShaderSourceVS = require('../shaders/BitmapMask.vert');
var Utils = require('../Utils');
var WebGLPipeline = require('../WebGLPipeline');
/**
* @classdesc
* [description]
*
* @class BitmapMaskPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @memberOf Phaser.Renderer.WebGL
* @constructor
* @since 3.0.0
*
* @param {Phaser.Game} game - [description]
* @param {[type]} gl - [description]
* @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - [description]
*/
var BitmapMaskPipeline = new Class({ var BitmapMaskPipeline = new Class({
Extends: WebGLPipeline, Extends: WebGLPipeline,
@ -39,11 +53,44 @@ var BitmapMaskPipeline = new Class({
] ]
}); });
/**
* [description]
*
* @name Phaser.Renderer.WebGL.BitmapMaskPipeline#vertexViewF32
* @type {Float32Array}
* @since 3.0.0
*/
this.vertexViewF32 = new Float32Array(this.vertexData); this.vertexViewF32 = new Float32Array(this.vertexData);
/**
* [description]
*
* @name Phaser.Renderer.WebGL.BitmapMaskPipeline#maxQuads
* @type {number}
* @default 1
* @since 3.0.0
*/
this.maxQuads = 1; this.maxQuads = 1;
/**
* [description]
*
* @name Phaser.Renderer.WebGL.BitmapMaskPipeline#resolutionDirty
* @type {boolean}
* @default true
* @since 3.0.0
*/
this.resolutionDirty = true; this.resolutionDirty = true;
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.BitmapMaskPipeline#onBind
* @since 3.0.0
*
* @return {Phaser.Renderer.WebGL.BitmapMaskPipeline} [description]
*/
onBind: function () onBind: function ()
{ {
WebGLPipeline.prototype.onBind.call(this); WebGLPipeline.prototype.onBind.call(this);
@ -62,6 +109,18 @@ var BitmapMaskPipeline = new Class({
return this; return this;
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.BitmapMaskPipeline#resize
* @since 3.0.0
*
* @param {number} width - [description]
* @param {number} height - [description]
* @param {number} resolution - [description]
*
* @return {Phaser.Renderer.WebGL.BitmapMaskPipeline} [description]
*/
resize: function (width, height, resolution) resize: function (width, height, resolution)
{ {
WebGLPipeline.prototype.resize.call(this, width, height, resolution); WebGLPipeline.prototype.resize.call(this, width, height, resolution);
@ -69,6 +128,16 @@ var BitmapMaskPipeline = new Class({
return this; return this;
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.BitmapMaskPipeline#beginMask
* @since 3.0.0
*
* @param {[type]} mask - [description]
* @param {[type]} maskedObject - [description]
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
*/
beginMask: function (mask, maskedObject, camera) beginMask: function (mask, maskedObject, camera)
{ {
var bitmapMask = mask.bitmapMask; var bitmapMask = mask.bitmapMask;
@ -96,6 +165,14 @@ var BitmapMaskPipeline = new Class({
} }
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.BitmapMaskPipeline#endMask
* @since 3.0.0
*
* @param {[type]} mask - [description]
*/
endMask: function (mask) endMask: function (mask)
{ {
var bitmapMask = mask.bitmapMask; var bitmapMask = mask.bitmapMask;

View file

@ -1,11 +1,11 @@
var Class = require('../../../utils/Class'); var Class = require('../../../utils/Class');
var WebGLPipeline = require('../WebGLPipeline');
var Utils = require('../Utils');
var Earcut = require('../../../geom/polygon/Earcut');
var ShaderSourceVS = require('../shaders/FlatTint.vert');
var ShaderSourceFS = require('../shaders/FlatTint.frag');
var Commands = require('../../../gameobjects/graphics/Commands'); var Commands = require('../../../gameobjects/graphics/Commands');
var Earcut = require('../../../geom/polygon/Earcut');
var ModelViewProjection = require('./components/ModelViewProjection'); var ModelViewProjection = require('./components/ModelViewProjection');
var ShaderSourceFS = require('../shaders/FlatTint.frag');
var ShaderSourceVS = require('../shaders/FlatTint.vert');
var Utils = require('../Utils');
var WebGLPipeline = require('../WebGLPipeline');
var Point = function (x, y, width, rgb, alpha) var Point = function (x, y, width, rgb, alpha)
{ {
@ -28,6 +28,20 @@ var matrixStack = new Float32Array(6 * 1000);
var matrixStackLength = 0; var matrixStackLength = 0;
var pathArray = []; var pathArray = [];
/**
* @classdesc
* [description]
*
* @class FlatTintPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @memberOf Phaser.Renderer.WebGL
* @constructor
* @since 3.0.0
*
* @param {Phaser.Game} game - [description]
* @param {[type]} gl - [description]
* @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - [description]
*/
var FlatTintPipeline = new Class({ var FlatTintPipeline = new Class({
Extends: WebGLPipeline, Extends: WebGLPipeline,
@ -71,18 +85,59 @@ var FlatTintPipeline = new Class({
] ]
}); });
/**
* [description]
*
* @name Phaser.Renderer.WebGL.FlatTintPipeline#vertexViewF32
* @type {Float32Array}
* @since 3.0.0
*/
this.vertexViewF32 = new Float32Array(this.vertexData); this.vertexViewF32 = new Float32Array(this.vertexData);
/**
* [description]
*
* @name Phaser.Renderer.WebGL.FlatTintPipeline#vertexViewU32
* @type {Uint32Array}
* @since 3.0.0
*/
this.vertexViewU32 = new Uint32Array(this.vertexData); this.vertexViewU32 = new Uint32Array(this.vertexData);
/**
* [description]
*
* @name Phaser.Renderer.WebGL.FlatTintPipeline#tempTriangle
* @type {array}
* @since 3.0.0
*/
this.tempTriangle = [ this.tempTriangle = [
{x: 0, y: 0, width: 0, rgb: 0xFFFFFF, alpha: 1.0}, {x: 0, y: 0, width: 0, rgb: 0xFFFFFF, alpha: 1.0},
{x: 0, y: 0, width: 0, rgb: 0xFFFFFF, alpha: 1.0}, {x: 0, y: 0, width: 0, rgb: 0xFFFFFF, alpha: 1.0},
{x: 0, y: 0, width: 0, rgb: 0xFFFFFF, alpha: 1.0}, {x: 0, y: 0, width: 0, rgb: 0xFFFFFF, alpha: 1.0},
{x: 0, y: 0, width: 0, rgb: 0xFFFFFF, alpha: 1.0} {x: 0, y: 0, width: 0, rgb: 0xFFFFFF, alpha: 1.0}
]; ];
/**
* [description]
*
* @name Phaser.Renderer.WebGL.FlatTintPipeline#polygonCache
* @type {array}
* @default []
* @since 3.0.0
*/
this.polygonCache = []; this.polygonCache = [];
this.mvpInit(); this.mvpInit();
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.FlatTintPipeline#onBind
* @since 3.0.0
*
* @return {Phaser.Renderer.WebGL.FlatTintPipeline} [description]
*/
onBind: function () onBind: function ()
{ {
WebGLPipeline.prototype.onBind.call(this); WebGLPipeline.prototype.onBind.call(this);
@ -91,6 +146,18 @@ var FlatTintPipeline = new Class({
return this; return this;
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.FlatTintPipeline#resize
* @since 3.0.0
*
* @param {number} width - [description]
* @param {number} height - [description]
* @param {number} resolution - [description]
*
* @return {Phaser.Renderer.WebGL.FlatTintPipeline} [description]
*/
resize: function (width, height, resolution) resize: function (width, height, resolution)
{ {
WebGLPipeline.prototype.resize.call(this, width, height, resolution); WebGLPipeline.prototype.resize.call(this, width, height, resolution);
@ -99,6 +166,32 @@ var FlatTintPipeline = new Class({
return this; return this;
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.FlatTintPipeline#batchFillRect
* @since 3.0.0
*
* @param {[type]} srcX - [description]
* @param {[type]} srcY - [description]
* @param {[type]} srcScaleX - [description]
* @param {[type]} srcScaleY - [description]
* @param {[type]} srcRotation - [description]
* @param {[type]} x - [description]
* @param {[type]} y - [description]
* @param {[type]} width - [description]
* @param {[type]} height - [description]
* @param {[type]} fillColor - [description]
* @param {[type]} fillAlpha - [description]
* @param {[type]} a1 - [description]
* @param {[type]} b1 - [description]
* @param {[type]} c1 - [description]
* @param {[type]} d1 - [description]
* @param {[type]} e1 - [description]
* @param {[type]} f1 - [description]
* @param {[type]} currentMatrix - [description]
* @param {[type]} roundPixels - [description]
*/
batchFillRect: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, x, y, width, height, fillColor, fillAlpha, a1, b1, c1, d1, e1, f1, currentMatrix, roundPixels) batchFillRect: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, x, y, width, height, fillColor, fillAlpha, a1, b1, c1, d1, e1, f1, currentMatrix, roundPixels)
{ {
this.renderer.setPipeline(this); this.renderer.setPipeline(this);
@ -171,6 +264,34 @@ var FlatTintPipeline = new Class({
this.vertexCount += 6; this.vertexCount += 6;
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.FlatTintPipeline#batchFillTriangle
* @since 3.0.0
*
* @param {[type]} srcX - [description]
* @param {[type]} srcY - [description]
* @param {[type]} srcScaleX - [description]
* @param {[type]} srcScaleY - [description]
* @param {[type]} srcRotation - [description]
* @param {[type]} x0 - [description]
* @param {[type]} y0 - [description]
* @param {[type]} x1 - [description]
* @param {[type]} y1 - [description]
* @param {[type]} x2 - [description]
* @param {[type]} y2 - [description]
* @param {[type]} fillColor - [description]
* @param {[type]} fillAlpha - [description]
* @param {[type]} a1 - [description]
* @param {[type]} b1 - [description]
* @param {[type]} c1 - [description]
* @param {[type]} d1 - [description]
* @param {[type]} e1 - [description]
* @param {[type]} f1 - [description]
* @param {[type]} currentMatrix - [description]
* @param {[type]} roundPixels - [description]
*/
batchFillTriangle: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, x0, y0, x1, y1, x2, y2, fillColor, fillAlpha, a1, b1, c1, d1, e1, f1, currentMatrix, roundPixels) batchFillTriangle: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, x0, y0, x1, y1, x2, y2, fillColor, fillAlpha, a1, b1, c1, d1, e1, f1, currentMatrix, roundPixels)
{ {
this.renderer.setPipeline(this); this.renderer.setPipeline(this);
@ -228,9 +349,37 @@ var FlatTintPipeline = new Class({
this.vertexCount += 3; this.vertexCount += 3;
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.FlatTintPipeline#batchStrokeTriangle
* @since 3.0.0
*
* @param {[type]} srcX - [description]
* @param {[type]} srcY - [description]
* @param {[type]} srcScaleX - [description]
* @param {[type]} srcScaleY - [description]
* @param {[type]} srcRotation - [description]
* @param {[type]} x0 - [description]
* @param {[type]} y0 - [description]
* @param {[type]} x1 - [description]
* @param {[type]} y1 - [description]
* @param {[type]} x2 - [description]
* @param {[type]} y2 - [description]
* @param {[type]} lineWidth - [description]
* @param {[type]} lineColor - [description]
* @param {[type]} lineAlpha - [description]
* @param {[type]} a - [description]
* @param {[type]} b - [description]
* @param {[type]} c - [description]
* @param {[type]} d - [description]
* @param {[type]} e - [description]
* @param {[type]} f - [description]
* @param {[type]} currentMatrix - [description]
* @param {[type]} roundPixels - [description]
*/
batchStrokeTriangle: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, x0, y0, x1, y1, x2, y2, lineWidth, lineColor, lineAlpha, a, b, c, d, e, f, currentMatrix, roundPixels) batchStrokeTriangle: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, x0, y0, x1, y1, x2, y2, lineWidth, lineColor, lineAlpha, a, b, c, d, e, f, currentMatrix, roundPixels)
{ {
var tempTriangle = this.tempTriangle; var tempTriangle = this.tempTriangle;
tempTriangle[0].x = x0; tempTriangle[0].x = x0;
@ -264,6 +413,29 @@ var FlatTintPipeline = new Class({
); );
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.FlatTintPipeline#batchFillPath
* @since 3.0.0
*
* @param {[type]} srcX - [description]
* @param {[type]} srcY - [description]
* @param {[type]} srcScaleX - [description]
* @param {[type]} srcScaleY - [description]
* @param {[type]} srcRotation - [description]
* @param {[type]} path - [description]
* @param {[type]} fillColor - [description]
* @param {[type]} fillAlpha - [description]
* @param {[type]} a1 - [description]
* @param {[type]} b1 - [description]
* @param {[type]} c1 - [description]
* @param {[type]} d1 - [description]
* @param {[type]} e1 - [description]
* @param {[type]} f1 - [description]
* @param {[type]} currentMatrix - [description]
* @param {[type]} roundPixels - [description]
*/
batchFillPath: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, path, fillColor, fillAlpha, a1, b1, c1, d1, e1, f1, currentMatrix, roundPixels) batchFillPath: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, path, fillColor, fillAlpha, a1, b1, c1, d1, e1, f1, currentMatrix, roundPixels)
{ {
this.renderer.setPipeline(this); this.renderer.setPipeline(this);
@ -356,6 +528,31 @@ var FlatTintPipeline = new Class({
polygonCache.length = 0; polygonCache.length = 0;
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.FlatTintPipeline#batchStrokePath
* @since 3.0.0
*
* @param {[type]} srcX - [description]
* @param {[type]} srcY - [description]
* @param {[type]} srcScaleX - [description]
* @param {[type]} srcScaleY - [description]
* @param {[type]} srcRotation - [description]
* @param {[type]} path - [description]
* @param {[type]} lineWidth - [description]
* @param {[type]} lineColor - [description]
* @param {[type]} lineAlpha - [description]
* @param {[type]} a - [description]
* @param {[type]} b - [description]
* @param {[type]} c - [description]
* @param {[type]} d - [description]
* @param {[type]} e - [description]
* @param {[type]} f - [description]
* @param {[type]} isLastPath - [description]
* @param {[type]} currentMatrix - [description]
* @param {[type]} roundPixels - [description]
*/
batchStrokePath: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, path, lineWidth, lineColor, lineAlpha, a, b, c, d, e, f, isLastPath, currentMatrix, roundPixels) batchStrokePath: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, path, lineWidth, lineColor, lineAlpha, a, b, c, d, e, f, isLastPath, currentMatrix, roundPixels)
{ {
this.renderer.setPipeline(this); this.renderer.setPipeline(this);
@ -424,9 +621,37 @@ var FlatTintPipeline = new Class({
} }
polylines.length = 0; polylines.length = 0;
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.FlatTintPipeline#batchLine
* @since 3.0.0
*
* @param {[type]} srcX - [description]
* @param {[type]} srcY - [description]
* @param {[type]} srcScaleX - [description]
* @param {[type]} srcScaleY - [description]
* @param {[type]} srcRotation - [description]
* @param {[type]} ax - [description]
* @param {[type]} ay - [description]
* @param {[type]} bx - [description]
* @param {[type]} by - [description]
* @param {[type]} aLineWidth - [description]
* @param {[type]} bLineWidth - [description]
* @param {[type]} aLineColor - [description]
* @param {[type]} bLineColor - [description]
* @param {[type]} lineAlpha - [description]
* @param {[type]} a1 - [description]
* @param {[type]} b1 - [description]
* @param {[type]} c1 - [description]
* @param {[type]} d1 - [description]
* @param {[type]} e1 - [description]
* @param {[type]} f1 - [description]
* @param {[type]} currentMatrix - [description]
* @param {[type]} roundPixels - [description]
*/
batchLine: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, ax, ay, bx, by, aLineWidth, bLineWidth, aLineColor, bLineColor, lineAlpha, a1, b1, c1, d1, e1, f1, currentMatrix, roundPixels) batchLine: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, ax, ay, bx, by, aLineWidth, bLineWidth, aLineColor, bLineColor, lineAlpha, a1, b1, c1, d1, e1, f1, currentMatrix, roundPixels)
{ {
this.renderer.setPipeline(this); this.renderer.setPipeline(this);
@ -521,6 +746,15 @@ var FlatTintPipeline = new Class({
]; ];
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.FlatTintPipeline#batchGraphics
* @since 3.0.0
*
* @param {Phaser.GameObjects.Graphics} graphics - [description]
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
*/
batchGraphics: function (graphics, camera) batchGraphics: function (graphics, camera)
{ {
if (graphics.commandBuffer.length <= 0) return; if (graphics.commandBuffer.length <= 0) return;
@ -877,42 +1111,132 @@ var FlatTintPipeline = new Class({
// Stubs // Stubs
/**
* [description]
*
* @method Phaser.Renderer.WebGL.FlatTintPipeline#drawStaticTilemapLayer
* @since 3.0.0
*
* @param {[type]} tilemap - [description]
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
*/
drawStaticTilemapLayer: function (tilemap, camera) drawStaticTilemapLayer: function (tilemap, camera)
{ {
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.FlatTintPipeline#drawEmitterManager
* @since 3.0.0
*
* @param {[type]} emitterManager - [description]
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
*/
drawEmitterManager: function (emitterManager, camera) drawEmitterManager: function (emitterManager, camera)
{ {
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.FlatTintPipeline#drawBlitter
* @since 3.0.0
*
* @param {[type]} blitter - [description]
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
*/
drawBlitter: function (blitter, camera) drawBlitter: function (blitter, camera)
{ {
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.FlatTintPipeline#batchSprite
* @since 3.0.0
*
* @param {[type]} sprite - [description]
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
*/
batchSprite: function (sprite, camera) batchSprite: function (sprite, camera)
{ {
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.FlatTintPipeline#batchMesh
* @since 3.0.0
*
* @param {[type]} mesh - [description]
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
*/
batchMesh: function (mesh, camera) batchMesh: function (mesh, camera)
{ {
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.FlatTintPipeline#batchBitmapText
* @since 3.0.0
*
* @param {[type]} bitmapText - [description]
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
*/
batchBitmapText: function (bitmapText, camera) batchBitmapText: function (bitmapText, camera)
{ {
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.FlatTintPipeline#batchDynamicBitmapText
* @since 3.0.0
*
* @param {[type]} bitmapText - [description]
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
*/
batchDynamicBitmapText: function (bitmapText, camera) batchDynamicBitmapText: function (bitmapText, camera)
{ {
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.FlatTintPipeline#batchText
* @since 3.0.0
*
* @param {[type]} text - [description]
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
*/
batchText: function (text, camera) batchText: function (text, camera)
{ {
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.FlatTintPipeline#batchDynamicTilemapLayer
* @since 3.0.0
*
* @param {[type]} tilemapLayer - [description]
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
*/
batchDynamicTilemapLayer: function (tilemapLayer, camera) batchDynamicTilemapLayer: function (tilemapLayer, camera)
{ {
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.FlatTintPipeline#batchTileSprite
* @since 3.0.0
*
* @param {[type]} tileSprite - [description]
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
*/
batchTileSprite: function (tileSprite, camera) batchTileSprite: function (tileSprite, camera)
{ {
} }

View file

@ -1,11 +1,25 @@
var Class = require('../../../utils/Class'); var Class = require('../../../utils/Class');
var WebGLPipeline = require('../WebGLPipeline');
var Utils = require('../Utils');
var TextureTintPipeline = require('./TextureTintPipeline');
var ShaderSourceFS = require('../shaders/ForwardDiffuse.frag'); var ShaderSourceFS = require('../shaders/ForwardDiffuse.frag');
var TextureTintPipeline = require('./TextureTintPipeline');
var Utils = require('../Utils');
var WebGLPipeline = require('../WebGLPipeline');
var LIGHT_COUNT = 10; var LIGHT_COUNT = 10;
/**
* @classdesc
* [description]
*
* @class ForwardDiffuseLightPipeline
* @extends Phaser.Renderer.WebGL.TextureTintPipeline
* @memberOf Phaser.Renderer.WebGL
* @constructor
* @since 3.0.0
*
* @param {Phaser.Game} game - [description]
* @param {[type]} gl - [description]
* @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - [description]
*/
var ForwardDiffuseLightPipeline = new Class({ var ForwardDiffuseLightPipeline = new Class({
Extends: TextureTintPipeline, Extends: TextureTintPipeline,
@ -17,6 +31,14 @@ var ForwardDiffuseLightPipeline = new Class({
TextureTintPipeline.call(this, game, gl, renderer, ShaderSourceFS.replace('%LIGHT_COUNT%', LIGHT_COUNT.toString())); TextureTintPipeline.call(this, game, gl, renderer, ShaderSourceFS.replace('%LIGHT_COUNT%', LIGHT_COUNT.toString()));
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#onBind
* @since 3.0.0
*
* @return {Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline} [description]
*/
onBind: function () onBind: function ()
{ {
TextureTintPipeline.prototype.onBind.call(this); TextureTintPipeline.prototype.onBind.call(this);
@ -32,6 +54,17 @@ var ForwardDiffuseLightPipeline = new Class({
return this; return this;
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#onRender
* @since 3.0.0
*
* @param {Phaser.Scene} scene - [description]
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
*
* @return {Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline} [description]
*/
onRender: function (scene, camera) onRender: function (scene, camera)
{ {
var lightManager = scene.lights; var lightManager = scene.lights;
@ -75,6 +108,17 @@ var ForwardDiffuseLightPipeline = new Class({
return this; return this;
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#drawStaticTilemapLayer
* @since 3.0.0
*
* @param {[type]} tilemap - [description]
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
*
* @return {[type]} [description]
*/
drawStaticTilemapLayer: function (tilemap, camera) drawStaticTilemapLayer: function (tilemap, camera)
{ {
var normalTexture = tilemap.texture.dataSource[0]; var normalTexture = tilemap.texture.dataSource[0];
@ -90,6 +134,17 @@ var ForwardDiffuseLightPipeline = new Class({
} }
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#drawEmitterManager
* @since 3.0.0
*
* @param {[type]} emitterManager - [description]
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
*
* @return {[type]} [description]
*/
drawEmitterManager: function (emitterManager, camera) drawEmitterManager: function (emitterManager, camera)
{ {
var normalTexture = emitterManager.texture.dataSource[0]; var normalTexture = emitterManager.texture.dataSource[0];
@ -105,6 +160,17 @@ var ForwardDiffuseLightPipeline = new Class({
} }
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#drawBlitter
* @since 3.0.0
*
* @param {Phaser.GameObjects.Blitter} blitter - [description]
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
*
* @return {[type]} [description]
*/
drawBlitter: function (blitter, camera) drawBlitter: function (blitter, camera)
{ {
var normalTexture = blitter.texture.dataSource[0]; var normalTexture = blitter.texture.dataSource[0];
@ -120,6 +186,17 @@ var ForwardDiffuseLightPipeline = new Class({
} }
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#batchSprite
* @since 3.0.0
*
* @param {Phaser.GameObjects.Sprite} sprite - [description]
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
*
* @return {[type]} [description]
*/
batchSprite: function (sprite, camera) batchSprite: function (sprite, camera)
{ {
var normalTexture = sprite.texture.dataSource[0]; var normalTexture = sprite.texture.dataSource[0];
@ -136,6 +213,17 @@ var ForwardDiffuseLightPipeline = new Class({
} }
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#batchMesh
* @since 3.0.0
*
* @param {Phaser.GameObjects.Mesh} mesh - [description]
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
*
* @return {[type]} [description]
*/
batchMesh: function (mesh, camera) batchMesh: function (mesh, camera)
{ {
var normalTexture = mesh.texture.dataSource[0]; var normalTexture = mesh.texture.dataSource[0];
@ -153,6 +241,17 @@ var ForwardDiffuseLightPipeline = new Class({
} }
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#batchBitmapText
* @since 3.0.0
*
* @param {[type]} bitmapText - [description]
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
*
* @return {[type]} [description]
*/
batchBitmapText: function (bitmapText, camera) batchBitmapText: function (bitmapText, camera)
{ {
var normalTexture = bitmapText.texture.dataSource[0]; var normalTexture = bitmapText.texture.dataSource[0];
@ -168,6 +267,17 @@ var ForwardDiffuseLightPipeline = new Class({
} }
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#batchDynamicBitmapText
* @since 3.0.0
*
* @param {[type]} bitmapText - [description]
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
*
* @return {[type]} [description]
*/
batchDynamicBitmapText: function (bitmapText, camera) batchDynamicBitmapText: function (bitmapText, camera)
{ {
var normalTexture = bitmapText.texture.dataSource[0]; var normalTexture = bitmapText.texture.dataSource[0];
@ -183,6 +293,17 @@ var ForwardDiffuseLightPipeline = new Class({
} }
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#batchText
* @since 3.0.0
*
* @param {[type]} text - [description]
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
*
* @return {[type]} [description]
*/
batchText: function (text, camera) batchText: function (text, camera)
{ {
var normalTexture = text.texture.dataSource[0]; var normalTexture = text.texture.dataSource[0];
@ -198,6 +319,17 @@ var ForwardDiffuseLightPipeline = new Class({
} }
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#batchDynamicTilemapLayer
* @since 3.0.0
*
* @param {[type]} tilemapLayer - [description]
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
*
* @return {[type]} [description]
*/
batchDynamicTilemapLayer: function (tilemapLayer, camera) batchDynamicTilemapLayer: function (tilemapLayer, camera)
{ {
var normalTexture = tilemapLayer.texture.dataSource[0]; var normalTexture = tilemapLayer.texture.dataSource[0];
@ -213,6 +345,17 @@ var ForwardDiffuseLightPipeline = new Class({
} }
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#batchTileSprite
* @since 3.0.0
*
* @param {Phaser.GameObjects.TileSprite} tileSprite - [description]
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
*
* @return {[type]} [description]
*/
batchTileSprite: function (tileSprite, camera) batchTileSprite: function (tileSprite, camera)
{ {
var normalTexture = tileSprite.texture.dataSource[0]; var normalTexture = tileSprite.texture.dataSource[0];

View file

@ -1,10 +1,25 @@
var Class = require('../../../utils/Class'); var Class = require('../../../utils/Class');
var WebGLPipeline = require('../WebGLPipeline');
var Utils = require('../Utils');
var ShaderSourceVS = require('../shaders/TextureTint.vert');
var ShaderSourceFS = require('../shaders/TextureTint.frag');
var ModelViewProjection = require('./components/ModelViewProjection'); var ModelViewProjection = require('./components/ModelViewProjection');
var ShaderSourceFS = require('../shaders/TextureTint.frag');
var ShaderSourceVS = require('../shaders/TextureTint.vert');
var Utils = require('../Utils');
var WebGLPipeline = require('../WebGLPipeline');
/**
* @classdesc
* [description]
*
* @class TextureTintPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @memberOf Phaser.Renderer.WebGL
* @constructor
* @since 3.0.0
*
* @param {Phaser.Game} game - [description]
* @param {[type]} gl - [description]
* @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - [description]
* @param {boolean} overrideFragmentShader - [description]
*/
var TextureTintPipeline = new Class({ var TextureTintPipeline = new Class({
Extends: WebGLPipeline, Extends: WebGLPipeline,
@ -56,12 +71,45 @@ var TextureTintPipeline = new Class({
] ]
}); });
/**
* [description]
*
* @name Phaser.Renderer.WebGL.TextureTintPipeline#vertexViewF32
* @type {Float32Array}
* @since 3.0.0
*/
this.vertexViewF32 = new Float32Array(this.vertexData); this.vertexViewF32 = new Float32Array(this.vertexData);
/**
* [description]
*
* @name Phaser.Renderer.WebGL.TextureTintPipeline#vertexViewU32
* @type {Uint32Array}
* @since 3.0.0
*/
this.vertexViewU32 = new Uint32Array(this.vertexData); this.vertexViewU32 = new Uint32Array(this.vertexData);
/**
* [description]
*
* @name Phaser.Renderer.WebGL.TextureTintPipeline#maxQuads
* @type {integer}
* @default 2000
* @since 3.0.0
*/
this.maxQuads = 2000; this.maxQuads = 2000;
this.mvpInit(); this.mvpInit();
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.TextureTintPipeline#onBind
* @since 3.0.0
*
* @return {Phaser.Renderer.WebGL.TextureTintPipeline} [description]
*/
onBind: function () onBind: function ()
{ {
WebGLPipeline.prototype.onBind.call(this); WebGLPipeline.prototype.onBind.call(this);
@ -70,14 +118,34 @@ var TextureTintPipeline = new Class({
return this; return this;
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.TextureTintPipeline#resize
* @since 3.0.0
*
* @param {number} width - [description]
* @param {number} height - [description]
* @param {number} resolution - [description]
*
* @return {Phaser.Renderer.WebGL.TextureTintPipeline} [description]
*/
resize: function (width, height, resolution) resize: function (width, height, resolution)
{ {
WebGLPipeline.prototype.resize.call(this, width, height, resolution); WebGLPipeline.prototype.resize.call(this, width, height, resolution);
this.projOrtho(0, this.width, this.height, 0, -1000.0, 1000.0); this.projOrtho(0, this.width, this.height, 0, -1000.0, 1000.0);
return this; return this;
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.TextureTintPipeline#drawStaticTilemapLayer
* @since 3.0.0
*
* @param {[type]} tilemap - [description]
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
*/
drawStaticTilemapLayer: function (tilemap, camera) drawStaticTilemapLayer: function (tilemap, camera)
{ {
if (tilemap.vertexCount > 0) if (tilemap.vertexCount > 0)
@ -107,6 +175,15 @@ var TextureTintPipeline = new Class({
this.modelIdentity(); this.modelIdentity();
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.TextureTintPipeline#drawEmitterManager
* @since 3.0.0
*
* @param {[type]} emitterManager - [description]
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
*/
drawEmitterManager: function (emitterManager, camera) drawEmitterManager: function (emitterManager, camera)
{ {
this.renderer.setPipeline(this); this.renderer.setPipeline(this);
@ -262,6 +339,15 @@ var TextureTintPipeline = new Class({
} }
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.TextureTintPipeline#drawBlitter
* @since 3.0.0
*
* @param {Phaser.GameObjects.Blitter} blitter - [description]
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
*/
drawBlitter: function (blitter, camera) drawBlitter: function (blitter, camera)
{ {
this.renderer.setPipeline(this); this.renderer.setPipeline(this);
@ -377,6 +463,15 @@ var TextureTintPipeline = new Class({
} }
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.TextureTintPipeline#batchSprite
* @since 3.0.0
*
* @param {Phaser.GameObjects.Sprite} sprite - [description]
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
*/
batchSprite: function (sprite, camera) batchSprite: function (sprite, camera)
{ {
this.renderer.setPipeline(this); this.renderer.setPipeline(this);
@ -502,6 +597,15 @@ var TextureTintPipeline = new Class({
this.vertexCount += 6; this.vertexCount += 6;
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.TextureTintPipeline#batchMesh
* @since 3.0.0
*
* @param {Phaser.GameObjects.Mesh} mesh - [description]
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
*/
batchMesh: function (mesh, camera) batchMesh: function (mesh, camera)
{ {
var vertices = mesh.vertices; var vertices = mesh.vertices;
@ -589,6 +693,15 @@ var TextureTintPipeline = new Class({
this.vertexCount += vertexCount; this.vertexCount += vertexCount;
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.TextureTintPipeline#batchBitmapText
* @since 3.0.0
*
* @param {[type]} bitmapText - [description]
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
*/
batchBitmapText: function (bitmapText, camera) batchBitmapText: function (bitmapText, camera)
{ {
this.renderer.setPipeline(this); this.renderer.setPipeline(this);
@ -803,6 +916,15 @@ var TextureTintPipeline = new Class({
} }
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.TextureTintPipeline#batchDynamicBitmapText
* @since 3.0.0
*
* @param {[type]} bitmapText - [description]
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
*/
batchDynamicBitmapText: function (bitmapText, camera) batchDynamicBitmapText: function (bitmapText, camera)
{ {
this.renderer.setPipeline(this); this.renderer.setPipeline(this);
@ -1094,6 +1216,15 @@ var TextureTintPipeline = new Class({
} }
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.TextureTintPipeline#batchText
* @since 3.0.0
*
* @param {[type]} text - [description]
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
*/
batchText: function (text, camera) batchText: function (text, camera)
{ {
var getTint = Utils.getTintAppendFloatAlpha; var getTint = Utils.getTintAppendFloatAlpha;
@ -1119,6 +1250,15 @@ var TextureTintPipeline = new Class({
); );
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.TextureTintPipeline#batchDynamicTilemapLayer
* @since 3.0.0
*
* @param {[type]} tilemapLayer - [description]
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
*/
batchDynamicTilemapLayer: function (tilemapLayer, camera) batchDynamicTilemapLayer: function (tilemapLayer, camera)
{ {
var renderTiles = tilemapLayer.culledTiles; var renderTiles = tilemapLayer.culledTiles;
@ -1166,6 +1306,15 @@ var TextureTintPipeline = new Class({
} }
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.TextureTintPipeline#batchTileSprite
* @since 3.0.0
*
* @param {Phaser.GameObjects.TileSprite} tileSprite - [description]
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
*/
batchTileSprite: function (tileSprite, camera) batchTileSprite: function (tileSprite, camera)
{ {
var getTint = Utils.getTintAppendFloatAlpha; var getTint = Utils.getTintAppendFloatAlpha;
@ -1192,6 +1341,41 @@ var TextureTintPipeline = new Class({
); );
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.TextureTintPipeline#batchTexture
* @since 3.0.0
*
* @param {Phaser.GameObjects.GameObject} gameObject - [description]
* @param {[type]} texture - [description]
* @param {[type]} textureWidth - [description]
* @param {[type]} textureHeight - [description]
* @param {[type]} srcX - [description]
* @param {[type]} srcY - [description]
* @param {[type]} srcWidth - [description]
* @param {[type]} srcHeight - [description]
* @param {[type]} scaleX - [description]
* @param {[type]} scaleY - [description]
* @param {[type]} rotation - [description]
* @param {[type]} flipX - [description]
* @param {[type]} flipY - [description]
* @param {[type]} scrollFactorX - [description]
* @param {[type]} scrollFactorY - [description]
* @param {[type]} displayOriginX - [description]
* @param {[type]} displayOriginY - [description]
* @param {[type]} frameX - [description]
* @param {[type]} frameY - [description]
* @param {[type]} frameWidth - [description]
* @param {[type]} frameHeight - [description]
* @param {[type]} tintTL - [description]
* @param {[type]} tintTR - [description]
* @param {[type]} tintBL - [description]
* @param {[type]} tintBR - [description]
* @param {[type]} uOffset - [description]
* @param {[type]} vOffset - [description]
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
*/
batchTexture: function ( batchTexture: function (
gameObject, gameObject,
texture, texture,
@ -1317,6 +1501,15 @@ var TextureTintPipeline = new Class({
this.vertexCount += 6; this.vertexCount += 6;
}, },
/**
* [description]
*
* @method Phaser.Renderer.WebGL.TextureTintPipeline#batchGraphics
* @since 3.0.0
*
* @param {[type]} graphics - [description]
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
*/
batchGraphics: function (graphics, camera) batchGraphics: function (graphics, camera)
{ {
// Stub // Stub

View file

@ -1,15 +1,94 @@
module.exports = { module.exports = {
/**
* Scene state.
*
* @name Phaser.Scenes.PENDING
* @type {integer}
* @since 3.0.0
*/
PENDING: 0, PENDING: 0,
/**
* Scene state.
*
* @name Phaser.Scenes.INIT
* @type {integer}
* @since 3.0.0
*/
INIT: 1, INIT: 1,
/**
* Scene state.
*
* @name Phaser.Scenes.START
* @type {integer}
* @since 3.0.0
*/
START: 2, START: 2,
/**
* Scene state.
*
* @name Phaser.Scenes.LOADING
* @type {integer}
* @since 3.0.0
*/
LOADING: 3, LOADING: 3,
/**
* Scene state.
*
* @name Phaser.Scenes.CREATING
* @type {integer}
* @since 3.0.0
*/
CREATING: 4, CREATING: 4,
/**
* Scene state.
*
* @name Phaser.Scenes.RUNNING
* @type {integer}
* @since 3.0.0
*/
RUNNING: 5, RUNNING: 5,
/**
* Scene state.
*
* @name Phaser.Scenes.PAUSED
* @type {integer}
* @since 3.0.0
*/
PAUSED: 6, PAUSED: 6,
/**
* Scene state.
*
* @name Phaser.Scenes.SLEEPING
* @type {integer}
* @since 3.0.0
*/
SLEEPING: 7, SLEEPING: 7,
/**
* Scene state.
*
* @name Phaser.Scenes.SHUTDOWN
* @type {integer}
* @since 3.0.0
*/
SHUTDOWN: 8, SHUTDOWN: 8,
/**
* Scene state.
*
* @name Phaser.Scenes.DESTROYED
* @type {integer}
* @since 3.0.0
*/
DESTROYED: 9 DESTROYED: 9
}; };

View file

@ -5,6 +5,7 @@
module.exports = { module.exports = {
Components: require('./components/'), Components: require('./components/'),
Parsers: require('./parsers'),
Formats: require('./Formats'), Formats: require('./Formats'),
ImageCollection: require('./ImageCollection'), ImageCollection: require('./ImageCollection'),

View file

@ -1,8 +1,8 @@
var Formats = require('../Formats');
var Parse2DArray = require('./Parse2DArray'); var Parse2DArray = require('./Parse2DArray');
var ParseCSV = require('./ParseCSV'); var ParseCSV = require('./ParseCSV');
var ParseTiledJSON = require('./parsetiledjson/'); var ParseTiledJSON = require('./tiled/');
var ParseWeltmister = require('./parseweltmeister/'); var ParseWeltmister = require('./impact/');
var Formats = require('../Formats');
/** /**
* Parses raw data of a given Tilemap format into a new MapData object. If no recognized data format * Parses raw data of a given Tilemap format into a new MapData object. If no recognized data format

View file

@ -1,6 +1,6 @@
var MapData = require('../mapdata/MapData');
var LayerData = require('../mapdata/LayerData');
var Formats = require('../Formats'); var Formats = require('../Formats');
var LayerData = require('../mapdata/LayerData');
var MapData = require('../mapdata/MapData');
var Tile = require('../Tile'); var Tile = require('../Tile');
/** /**

View file

@ -0,0 +1,14 @@
/**
* @namespace Phaser.Tilemaps.Parsers
*/
module.exports = {
Parse: require('./Parse'),
Parse2DArray: require('./Parse2DArray'),
ParseCSV: require('./ParseCSV'),
Impact: require('./impact'),
Tiled: require('./tiled')
};

View file

@ -1,4 +1,3 @@
var Pick = require('./Pick'); var Pick = require('./Pick');
var ParseGID = require('./ParseGID'); var ParseGID = require('./ParseGID');

View file

@ -1,12 +1,24 @@
var HasValue = require('../../../utils/object/HasValue'); var HasValue = require('../../../utils/object/HasValue');
var pick = function (object, keys) /**
* [description]
*
* @function Phaser.Tilemaps.Parsers.Tiled.Pick
* @since 3.0.0
*
* @param {[type]} object - [description]
* @param {[type]} keys - [description]
*
* @return {[type]} [description]
*/
var Pick = function (object, keys)
{ {
var obj = {}; var obj = {};
for (var i = 0; i < keys.length; i++) for (var i = 0; i < keys.length; i++)
{ {
var key = keys[i]; var key = keys[i];
if (HasValue(object, key)) if (HasValue(object, key))
{ {
obj[key] = object[key]; obj[key] = object[key];
@ -16,4 +28,4 @@ var pick = function (object, keys)
return obj; return obj;
}; };
module.exports = pick; module.exports = Pick;

View file

@ -1,26 +1,158 @@
var TWEEN_CONST = { var TWEEN_CONST = {
// TweenData: /**
* TweenData state.
*
* @name Phaser.Tweens.CREATED
* @type {integer}
* @since 3.0.0
*/
CREATED: 0, CREATED: 0,
/**
* TweenData state.
*
* @name Phaser.Tweens.INIT
* @type {integer}
* @since 3.0.0
*/
INIT: 1, INIT: 1,
/**
* TweenData state.
*
* @name Phaser.Tweens.OFFSET_DELAY
* @type {integer}
* @since 3.0.0
*/
DELAY: 2, DELAY: 2,
/**
* TweenData state.
*
* @name Phaser.Tweens.OFFSET_DELAY
* @type {integer}
* @since 3.0.0
*/
OFFSET_DELAY: 3, OFFSET_DELAY: 3,
/**
* TweenData state.
*
* @name Phaser.Tweens.PLAYING_FORWARD
* @type {integer}
* @since 3.0.0
*/
PENDING_RENDER: 4, PENDING_RENDER: 4,
/**
* TweenData state.
*
* @name Phaser.Tweens.PLAYING_FORWARD
* @type {integer}
* @since 3.0.0
*/
PLAYING_FORWARD: 5, PLAYING_FORWARD: 5,
/**
* TweenData state.
*
* @name Phaser.Tweens.PLAYING_BACKWARD
* @type {integer}
* @since 3.0.0
*/
PLAYING_BACKWARD: 6, PLAYING_BACKWARD: 6,
/**
* TweenData state.
*
* @name Phaser.Tweens.HOLD_DELAY
* @type {integer}
* @since 3.0.0
*/
HOLD_DELAY: 7, HOLD_DELAY: 7,
/**
* TweenData state.
*
* @name Phaser.Tweens.REPEAT_DELAY
* @type {integer}
* @since 3.0.0
*/
REPEAT_DELAY: 8, REPEAT_DELAY: 8,
/**
* TweenData state.
*
* @name Phaser.Tweens.COMPLETE
* @type {integer}
* @since 3.0.0
*/
COMPLETE: 9, COMPLETE: 9,
// Tween specific (starts from 20 to cleanly allow extra TweenData consts in the future) // Tween specific (starts from 20 to cleanly allow extra TweenData consts in the future)
/**
* Tween state.
*
* @name Phaser.Tweens.PENDING_ADD
* @type {integer}
* @since 3.0.0
*/
PENDING_ADD: 20, PENDING_ADD: 20,
/**
* Tween state.
*
* @name Phaser.Tweens.LOOP_DELAY
* @type {integer}
* @since 3.0.0
*/
PAUSED: 21, PAUSED: 21,
/**
* Tween state.
*
* @name Phaser.Tweens.LOOP_DELAY
* @type {integer}
* @since 3.0.0
*/
LOOP_DELAY: 22, LOOP_DELAY: 22,
/**
* Tween state.
*
* @name Phaser.Tweens.ACTIVE
* @type {integer}
* @since 3.0.0
*/
ACTIVE: 23, ACTIVE: 23,
/**
* Tween state.
*
* @name Phaser.Tweens.COMPLETE_DELAY
* @type {integer}
* @since 3.0.0
*/
COMPLETE_DELAY: 24, COMPLETE_DELAY: 24,
/**
* Tween state.
*
* @name Phaser.Tweens.PENDING_REMOVE
* @type {integer}
* @since 3.0.0
*/
PENDING_REMOVE: 25, PENDING_REMOVE: 25,
/**
* Tween state.
*
* @name Phaser.Tweens.REMOVED
* @type {integer}
* @since 3.0.0
*/
REMOVED: 26 REMOVED: 26
}; };