mirror of
https://github.com/photonstorm/phaser
synced 2024-12-18 09:03:29 +00:00
Merge branch 'master' into rendering-cleanup
This commit is contained in:
commit
79805ac04f
79 changed files with 99 additions and 2089 deletions
|
@ -1,29 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var AddAnimationEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
/**
|
|
||||||
* [description]
|
|
||||||
*
|
|
||||||
* @event AddAnimationEvent
|
|
||||||
* @type {Phaser.Event}
|
|
||||||
*
|
|
||||||
* @param {string} key - [description]
|
|
||||||
* @param {Phaser.Animations.Animation} animation - [description]
|
|
||||||
*/
|
|
||||||
function AddAnimationEvent (key, animation)
|
|
||||||
{
|
|
||||||
Event.call(this, 'ADD_ANIMATION_EVENT');
|
|
||||||
|
|
||||||
this.key = key;
|
|
||||||
this.animation = animation;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = AddAnimationEvent;
|
|
|
@ -1,23 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var PauseAllAnimationEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
/**
|
|
||||||
* [description]
|
|
||||||
*
|
|
||||||
* @event PauseAllAnimationEvent
|
|
||||||
* @type {Phaser.Event}
|
|
||||||
*/
|
|
||||||
function PauseAllAnimationEvent ()
|
|
||||||
{
|
|
||||||
Event.call(this, 'PAUSE_ALL_ANIMATION_EVENT');
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = PauseAllAnimationEvent;
|
|
|
@ -1,29 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var RemoveAnimationEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
/**
|
|
||||||
* [description]
|
|
||||||
*
|
|
||||||
* @event RemoveAnimationEvent
|
|
||||||
* @type {Phaser.Event}
|
|
||||||
*
|
|
||||||
* @param {string} key - [description]
|
|
||||||
* @param {Phaser.Animations.Animation} animation - [description]
|
|
||||||
*/
|
|
||||||
function RemoveAnimationEvent (key, animation)
|
|
||||||
{
|
|
||||||
Event.call(this, 'REMOVE_ANIMATION_EVENT');
|
|
||||||
|
|
||||||
this.key = key;
|
|
||||||
this.animation = animation;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = RemoveAnimationEvent;
|
|
|
@ -1,23 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var ResumeAllAnimationEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
/**
|
|
||||||
* [description]
|
|
||||||
*
|
|
||||||
* @event ResumeAllAnimationEvent
|
|
||||||
* @type {Phaser.Event}
|
|
||||||
*/
|
|
||||||
function ResumeAllAnimationEvent ()
|
|
||||||
{
|
|
||||||
Event.call(this, 'RESUME_ALL_ANIMATION_EVENT');
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = ResumeAllAnimationEvent;
|
|
|
@ -1,6 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
ADD_ANIMATION_EVENT: require('./AddAnimationEvent'),
|
|
||||||
PAUSE_ALL_ANIMATION_EVENT: require('./PauseAllAnimationEvent'),
|
|
||||||
REMOVE_ANIMATION_EVENT: require('./RemoveAnimationEvent'),
|
|
||||||
RESUME_ALL_ANIMATION_EVENT: require('./ResumeAllAnimationEvent')
|
|
||||||
};
|
|
31
src/cache/events/CacheAddEvent.js
vendored
31
src/cache/events/CacheAddEvent.js
vendored
|
@ -1,31 +0,0 @@
|
||||||
var Class = require('../../utils/Class');
|
|
||||||
var Event = require('../../events/Event');
|
|
||||||
|
|
||||||
var CacheAddEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
/**
|
|
||||||
* [description]
|
|
||||||
*
|
|
||||||
* @event CacheAddEvent
|
|
||||||
* @type {Phaser.Event}
|
|
||||||
*
|
|
||||||
* @param {Phaser.Cache.BaseCache} cache - [description]
|
|
||||||
* @param {string} key - [description]
|
|
||||||
* @param {any} data - [description]
|
|
||||||
*/
|
|
||||||
function CacheAddEvent (cache, key, data)
|
|
||||||
{
|
|
||||||
Event.call(this, 'CACHE_ADD_EVENT');
|
|
||||||
|
|
||||||
this.cache = cache;
|
|
||||||
this.key = key;
|
|
||||||
this.data = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = CacheAddEvent;
|
|
31
src/cache/events/CacheRemoveEvent.js
vendored
31
src/cache/events/CacheRemoveEvent.js
vendored
|
@ -1,31 +0,0 @@
|
||||||
var Class = require('../../utils/Class');
|
|
||||||
var Event = require('../../events/Event');
|
|
||||||
|
|
||||||
var CacheRemoveEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
/**
|
|
||||||
* [description]
|
|
||||||
*
|
|
||||||
* @event CacheRemoveEvent
|
|
||||||
* @type {Phaser.Event}
|
|
||||||
*
|
|
||||||
* @param {Phaser.Cache.BaseCache} cache - [description]
|
|
||||||
* @param {string} key - [description]
|
|
||||||
* @param {any} data - [description]
|
|
||||||
*/
|
|
||||||
function CacheRemoveEvent (cache, key, data)
|
|
||||||
{
|
|
||||||
Event.call(this, 'CACHE_REMOVE_EVENT');
|
|
||||||
|
|
||||||
this.cache = cache;
|
|
||||||
this.key = key;
|
|
||||||
this.data = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = CacheRemoveEvent;
|
|
6
src/cache/events/index.js
vendored
6
src/cache/events/index.js
vendored
|
@ -1,6 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
|
|
||||||
CACHE_ADD_EVENT: require('./CacheAddEvent'),
|
|
||||||
CACHE_REMOVE_EVENT: require('./CacheRemoveEvent')
|
|
||||||
|
|
||||||
};
|
|
|
@ -1,5 +1,4 @@
|
||||||
var Class = require('../utils/Class');
|
var Class = require('../utils/Class');
|
||||||
var Event = require('../events/Event');
|
|
||||||
var EventEmitter = require('eventemitter3');
|
var EventEmitter = require('eventemitter3');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -10,11 +9,11 @@ var Data = new Class({
|
||||||
|
|
||||||
initialize:
|
initialize:
|
||||||
|
|
||||||
function Data (parent, eventDispatcher)
|
function Data (parent, eventEmitter)
|
||||||
{
|
{
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
|
|
||||||
this.events = (eventDispatcher) ? eventDispatcher : new EventEmitter();
|
this.events = (eventEmitter) ? eventEmitter : new EventEmitter();
|
||||||
|
|
||||||
this.list = {};
|
this.list = {};
|
||||||
|
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
var Class = require('../utils/Class');
|
|
||||||
|
|
||||||
var Event = new Class({
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function Event (type)
|
|
||||||
{
|
|
||||||
this.type = type;
|
|
||||||
|
|
||||||
// The element that initiated the event.
|
|
||||||
this.target;
|
|
||||||
|
|
||||||
this._propagate = true;
|
|
||||||
},
|
|
||||||
|
|
||||||
reset: function (target)
|
|
||||||
{
|
|
||||||
this.target = target;
|
|
||||||
|
|
||||||
this._propagate = true;
|
|
||||||
},
|
|
||||||
|
|
||||||
stopPropagation: function ()
|
|
||||||
{
|
|
||||||
this._propagate = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = Event;
|
|
|
@ -1,274 +0,0 @@
|
||||||
var Class = require('../utils/Class');
|
|
||||||
var CONST = require('./const');
|
|
||||||
var EventListener = require('./EventListener');
|
|
||||||
|
|
||||||
var EventBinding = new Class({
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function EventBinding (dispatcher, type)
|
|
||||||
{
|
|
||||||
this.dispatcher = dispatcher;
|
|
||||||
this.type = type;
|
|
||||||
this.state = CONST.DISPATCHER_IDLE;
|
|
||||||
this.active = [];
|
|
||||||
},
|
|
||||||
|
|
||||||
total: function ()
|
|
||||||
{
|
|
||||||
var total = 0;
|
|
||||||
|
|
||||||
for (var i = 0; i < this.active.length; i++)
|
|
||||||
{
|
|
||||||
if (this.active[i].state !== CONST.LISTENER_REMOVING)
|
|
||||||
{
|
|
||||||
total++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return total;
|
|
||||||
},
|
|
||||||
|
|
||||||
get: function (callback)
|
|
||||||
{
|
|
||||||
for (var i = 0; i < this.active.length; i++)
|
|
||||||
{
|
|
||||||
if (this.active[i].callback === callback)
|
|
||||||
{
|
|
||||||
return this.active[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
getIndex: function (callback)
|
|
||||||
{
|
|
||||||
for (var i = 0; i < this.active.length; i++)
|
|
||||||
{
|
|
||||||
if (this.active[i].callback === callback)
|
|
||||||
{
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
|
|
||||||
has: function (callback)
|
|
||||||
{
|
|
||||||
return (this.get(callback));
|
|
||||||
},
|
|
||||||
|
|
||||||
// Called by EventDispatcher.on and EventDispatcher.once
|
|
||||||
add: function (callback, priority, scope, once)
|
|
||||||
{
|
|
||||||
// EventListener
|
|
||||||
var listener = this.get(callback);
|
|
||||||
|
|
||||||
if (!listener)
|
|
||||||
{
|
|
||||||
// The listener doesn't exist, so create one
|
|
||||||
listener = EventListener(this.type, callback, scope, priority, once);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Listener already exists, abort
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.state === CONST.DISPATCHER_IDLE)
|
|
||||||
{
|
|
||||||
// The Dispatcher isn't doing anything, so we don't need a pending state
|
|
||||||
listener.state = CONST.LISTENER_ACTIVE;
|
|
||||||
|
|
||||||
this.active.push(listener);
|
|
||||||
|
|
||||||
this.active.sort(this.sortHandler);
|
|
||||||
}
|
|
||||||
else if (this.state === CONST.DISPATCHER_DISPATCHING)
|
|
||||||
{
|
|
||||||
// Add it to the list, but keep the state as pending.
|
|
||||||
// The call to 'tidy' will sort it out at the end of the dispatch.
|
|
||||||
this.active.push(listener);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
sortHandler: function (listenerA, listenerB)
|
|
||||||
{
|
|
||||||
if (listenerB.priority < listenerA.priority)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
else if (listenerB.priority > listenerA.priority)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
remove: function (callback)
|
|
||||||
{
|
|
||||||
if (this.state === CONST.DISPATCHER_IDLE)
|
|
||||||
{
|
|
||||||
// The Dispatcher isn't doing anything, so we can remove right away
|
|
||||||
var i = this.getIndex(callback);
|
|
||||||
|
|
||||||
if (i !== null)
|
|
||||||
{
|
|
||||||
this.active.splice(i, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (this.state === CONST.DISPATCHER_DISPATCHING)
|
|
||||||
{
|
|
||||||
// The Dispatcher is working, so we flag the listener for removal at the end
|
|
||||||
var listener = this.get(callback);
|
|
||||||
|
|
||||||
if (listener)
|
|
||||||
{
|
|
||||||
listener.state = CONST.LISTENER_REMOVING;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
dispatch: function (event)
|
|
||||||
{
|
|
||||||
if (this.state !== CONST.DISPATCHER_IDLE)
|
|
||||||
{
|
|
||||||
throw new Error('Error: Failed to execute \'EventDispatcher.dispatch\' on \'' + this.type + '\': The event is already being dispatched.');
|
|
||||||
}
|
|
||||||
else if (this.active.length === 0)
|
|
||||||
{
|
|
||||||
// This was a valid dispatch call, we just had nothing to do ...
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.state = CONST.DISPATCHER_DISPATCHING;
|
|
||||||
|
|
||||||
var listener;
|
|
||||||
|
|
||||||
for (var i = 0; i < this.active.length; i++)
|
|
||||||
{
|
|
||||||
// EventListener
|
|
||||||
listener = this.active[i];
|
|
||||||
|
|
||||||
if (listener.state !== CONST.LISTENER_ACTIVE)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// listener.callback.call(this.dispatcher, event);
|
|
||||||
listener.callback.call(listener.scope, event);
|
|
||||||
|
|
||||||
// Has the callback changed the state of this binding?
|
|
||||||
if (this.state !== CONST.DISPATCHER_DISPATCHING)
|
|
||||||
{
|
|
||||||
// Yup! Let's break out
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Was it a 'once' listener?
|
|
||||||
if (listener.once)
|
|
||||||
{
|
|
||||||
listener.state = CONST.LISTENER_REMOVING;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Has the event been halted by the callback?
|
|
||||||
if (!event._propagate)
|
|
||||||
{
|
|
||||||
// Break out, a listener has called Event.stopPropagation
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Dispatch over, or aborted
|
|
||||||
if (this.state === CONST.DISPATCHER_REMOVING)
|
|
||||||
{
|
|
||||||
this.removeAll();
|
|
||||||
|
|
||||||
// All done, tidy the list in case there were any pending events added
|
|
||||||
this.tidy();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// All done, just purge the list
|
|
||||||
this.tidy();
|
|
||||||
|
|
||||||
this.state = CONST.DISPATCHER_IDLE;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// Removes all listeners
|
|
||||||
// If this is currently being dispatched then don't remove 'pending' listeners
|
|
||||||
// (i.e. ones that were added during the dispatch), only active ones
|
|
||||||
removeAll: function ()
|
|
||||||
{
|
|
||||||
if (this.state === CONST.DISPATCHER_IDLE)
|
|
||||||
{
|
|
||||||
this.active.length = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (var i = this.active.length - 1; i >= 0; i--)
|
|
||||||
{
|
|
||||||
if (this.active[i].state !== CONST.LISTENER_PENDING)
|
|
||||||
{
|
|
||||||
this.active.pop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.state = CONST.DISPATCHER_IDLE;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
tidy: function ()
|
|
||||||
{
|
|
||||||
// Nothing to do ...
|
|
||||||
if (this.active.length === 0)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var added = 0;
|
|
||||||
|
|
||||||
var i = this.active.length - 1;
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
if (this.active[i].state === CONST.LISTENER_REMOVING)
|
|
||||||
{
|
|
||||||
this.active.splice(i, 1);
|
|
||||||
}
|
|
||||||
else if (this.active[i].state === CONST.LISTENER_PENDING)
|
|
||||||
{
|
|
||||||
this.active[i].state = CONST.LISTENER_ACTIVE;
|
|
||||||
added++;
|
|
||||||
}
|
|
||||||
|
|
||||||
i--;
|
|
||||||
}
|
|
||||||
while (i >= 0);
|
|
||||||
|
|
||||||
if (added > 0)
|
|
||||||
{
|
|
||||||
this.active.sort(this.sortHandler);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
destroy: function ()
|
|
||||||
{
|
|
||||||
delete this.dispatcher.bindings[this.type];
|
|
||||||
|
|
||||||
this.active.length = 0;
|
|
||||||
|
|
||||||
this.dispatcher = null;
|
|
||||||
|
|
||||||
this.type = '';
|
|
||||||
|
|
||||||
this.state = CONST.DISPATCHER_DESTROYED;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = EventBinding;
|
|
|
@ -1,241 +0,0 @@
|
||||||
var Class = require('../utils/Class');
|
|
||||||
var CONST = require('./const');
|
|
||||||
var EventBinding = require('./EventBinding');
|
|
||||||
|
|
||||||
var EventDispatcher = new Class({
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function EventDispatcher ()
|
|
||||||
{
|
|
||||||
this.bindings = {};
|
|
||||||
this.filters = [];
|
|
||||||
this.hasFilters = false;
|
|
||||||
},
|
|
||||||
|
|
||||||
getBinding: function (type)
|
|
||||||
{
|
|
||||||
if (this.bindings.hasOwnProperty(type))
|
|
||||||
{
|
|
||||||
return this.bindings[type];
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
createBinding: function (type)
|
|
||||||
{
|
|
||||||
if (!this.getBinding(type))
|
|
||||||
{
|
|
||||||
this.bindings[type] = new EventBinding(this, type);
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.bindings[type];
|
|
||||||
},
|
|
||||||
|
|
||||||
on: function (type, listener, priority, scope)
|
|
||||||
{
|
|
||||||
if (priority === undefined) { priority = 0; }
|
|
||||||
if (scope === undefined) { scope = this; }
|
|
||||||
|
|
||||||
var binding = this.createBinding(type);
|
|
||||||
|
|
||||||
if (binding)
|
|
||||||
{
|
|
||||||
binding.add(listener, priority, scope, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
once: function (type, listener, priority, scope)
|
|
||||||
{
|
|
||||||
if (priority === undefined) { priority = 0; }
|
|
||||||
if (scope === undefined) { scope = this; }
|
|
||||||
|
|
||||||
var binding = this.createBinding(type);
|
|
||||||
|
|
||||||
if (binding)
|
|
||||||
{
|
|
||||||
binding.add(listener, priority, scope, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
// Add a callback that is notified every time this EventDispatcher dispatches an event
|
|
||||||
// no matter what the event type is. Filters are invoked first, before any bindings,
|
|
||||||
// and can stop events if they wish (in which case they'll never reach the bindings)
|
|
||||||
filter: function (callback)
|
|
||||||
{
|
|
||||||
var i = this.filters.indexOf(callback);
|
|
||||||
|
|
||||||
if (i === -1)
|
|
||||||
{
|
|
||||||
// Add the filter
|
|
||||||
this.filters.push(callback);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Remove the filter
|
|
||||||
this.filters.splice(i, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.hasFilters = (this.filters.length > 0);
|
|
||||||
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
has: function (type, listener)
|
|
||||||
{
|
|
||||||
var binding = this.getBinding(type);
|
|
||||||
|
|
||||||
if (binding)
|
|
||||||
{
|
|
||||||
return binding.has(listener);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
total: function (type)
|
|
||||||
{
|
|
||||||
var binding = this.getBinding(type);
|
|
||||||
|
|
||||||
if (binding)
|
|
||||||
{
|
|
||||||
return binding.total();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// Removes an event listener.
|
|
||||||
// If there is no matching listener registered with the EventDispatcher, a call to this method has no effect.
|
|
||||||
off: function (type, listener)
|
|
||||||
{
|
|
||||||
var binding = this.getBinding(type);
|
|
||||||
|
|
||||||
if (binding)
|
|
||||||
{
|
|
||||||
binding.remove(listener);
|
|
||||||
}
|
|
||||||
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
_dispatchHandler: function (event)
|
|
||||||
{
|
|
||||||
event.reset(this);
|
|
||||||
|
|
||||||
// Pass the event through the filters first
|
|
||||||
|
|
||||||
if (this.hasFilters)
|
|
||||||
{
|
|
||||||
for (var i = 0; i < this.filters.length; i++)
|
|
||||||
{
|
|
||||||
this.filters[i].call(this, event);
|
|
||||||
|
|
||||||
// Did the filter kill the event? If so, we can abort now
|
|
||||||
if (!event._propagate)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var binding = this.getBinding(event.type);
|
|
||||||
|
|
||||||
if (binding)
|
|
||||||
{
|
|
||||||
binding.dispatch(event);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
dispatch: function (event)
|
|
||||||
{
|
|
||||||
if (Array.isArray(event))
|
|
||||||
{
|
|
||||||
for (var i = 0; i < event.length; i++)
|
|
||||||
{
|
|
||||||
this._dispatchHandler(event[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this._dispatchHandler(event);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// Removes all listeners, but retains the event type entries
|
|
||||||
removeAll: function (type)
|
|
||||||
{
|
|
||||||
var binding = this.getBinding(type);
|
|
||||||
|
|
||||||
if (binding)
|
|
||||||
{
|
|
||||||
binding.removeAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
removeAllListeners: function (type)
|
|
||||||
{
|
|
||||||
var binding = this.getBinding(type);
|
|
||||||
|
|
||||||
if (binding)
|
|
||||||
{
|
|
||||||
binding.removeAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
removeAllFilters: function ()
|
|
||||||
{
|
|
||||||
this.filters.length = 0;
|
|
||||||
|
|
||||||
this.hasFilters = false;
|
|
||||||
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
delete: function (type)
|
|
||||||
{
|
|
||||||
var binding = this.getBinding(type);
|
|
||||||
|
|
||||||
if (binding)
|
|
||||||
{
|
|
||||||
if (binding.state === CONST.DISPATCHER_IDLE)
|
|
||||||
{
|
|
||||||
binding.destroy();
|
|
||||||
|
|
||||||
delete this.bindings[type];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
binding.state = CONST.DISPATCHER_DESTROYED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
deleteAll: function ()
|
|
||||||
{
|
|
||||||
for (var binding in this.bindings)
|
|
||||||
{
|
|
||||||
this.bindings[binding].destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.bindings = {};
|
|
||||||
},
|
|
||||||
|
|
||||||
destroy: function ()
|
|
||||||
{
|
|
||||||
this.deleteAll();
|
|
||||||
this.removeAllFilters();
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = EventDispatcher;
|
|
19
src/events/EventEmitter.js
Normal file
19
src/events/EventEmitter.js
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
var Class = require('../utils/Class');
|
||||||
|
var EE = require('eventemitter3');
|
||||||
|
|
||||||
|
// Phaser.EventEmitter
|
||||||
|
|
||||||
|
var EventEmitter = new Class({
|
||||||
|
|
||||||
|
Extends: EE,
|
||||||
|
|
||||||
|
initialize:
|
||||||
|
|
||||||
|
function EventEmitter ()
|
||||||
|
{
|
||||||
|
EE.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = EventEmitter;
|
|
@ -1,15 +0,0 @@
|
||||||
var CONST = require('./const');
|
|
||||||
|
|
||||||
var EventListener = function (type, callback, scope, priority, once)
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
type: type,
|
|
||||||
callback: callback,
|
|
||||||
scope: scope,
|
|
||||||
priority: priority,
|
|
||||||
once: once,
|
|
||||||
state: CONST.LISTENER_PENDING
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = EventListener;
|
|
|
@ -1,14 +0,0 @@
|
||||||
var EVENT_CONST = {
|
|
||||||
|
|
||||||
DISPATCHER_IDLE: 0,
|
|
||||||
DISPATCHER_DISPATCHING: 1,
|
|
||||||
DISPATCHER_REMOVING: 2,
|
|
||||||
DISPATCHER_DESTROYED: 3,
|
|
||||||
|
|
||||||
LISTENER_PENDING: 4,
|
|
||||||
LISTENER_ACTIVE: 5,
|
|
||||||
LISTENER_REMOVING: 6
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = EVENT_CONST;
|
|
|
@ -1,7 +1,6 @@
|
||||||
// Phaser.Input.Gamepad.Axis
|
// Phaser.Input.Gamepad.Axis
|
||||||
|
|
||||||
var Class = require('../../utils/Class');
|
var Class = require('../../utils/Class');
|
||||||
var GamepadEvent = require('./events/');
|
|
||||||
|
|
||||||
var Axis = new Class({
|
var Axis = new Class({
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
var Axis = require('./Axis');
|
var Axis = require('./Axis');
|
||||||
var Button = require('./Button');
|
var Button = require('./Button');
|
||||||
var Class = require('../../utils/Class');
|
var Class = require('../../utils/Class');
|
||||||
var GamepadEvent = require('./events/');
|
|
||||||
|
|
||||||
var Gamepad = new Class({
|
var Gamepad = new Class({
|
||||||
|
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var GamepadConnectedEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function GamepadConnectedEvent (gamepad, nativeEvent)
|
|
||||||
{
|
|
||||||
Event.call(this, 'GAMEPAD_CONNECTED_EVENT');
|
|
||||||
|
|
||||||
this.data = nativeEvent;
|
|
||||||
|
|
||||||
this.gamepad = gamepad;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = GamepadConnectedEvent;
|
|
|
@ -1,21 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var GamepadDisconnectedEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function GamepadDisconnectedEvent (gamepad, nativeEvent)
|
|
||||||
{
|
|
||||||
Event.call(this, 'GAMEPAD_DISCONNECTED_EVENT');
|
|
||||||
|
|
||||||
this.data = nativeEvent;
|
|
||||||
|
|
||||||
this.gamepad = gamepad;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = GamepadDisconnectedEvent;
|
|
|
@ -1,23 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var GamepadDownEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function GamepadDownEvent (gamepad, button, value, nativeEvent)
|
|
||||||
{
|
|
||||||
Event.call(this, 'GAMEPAD_DOWN_EVENT');
|
|
||||||
|
|
||||||
this.data = nativeEvent;
|
|
||||||
|
|
||||||
this.gamepad = gamepad;
|
|
||||||
this.button = button;
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = GamepadDownEvent;
|
|
|
@ -1,23 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var GamepadUpEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function GamepadUpEvent (gamepad, button, value, nativeEvent)
|
|
||||||
{
|
|
||||||
Event.call(this, 'GAMEPAD_UP_EVENT');
|
|
||||||
|
|
||||||
this.data = nativeEvent;
|
|
||||||
|
|
||||||
this.gamepad = gamepad;
|
|
||||||
this.button = button;
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = GamepadUpEvent;
|
|
|
@ -1,8 +0,0 @@
|
||||||
// Phaser.Input.Gamepad.Events
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
CONNECTED: require('./GamepadConnectedEvent'),
|
|
||||||
DISCONNECTED: require('./GamepadDisconnectedEvent'),
|
|
||||||
DOWN: require('./GamepadDownEvent'),
|
|
||||||
UP: require('./GamepadUpEvent')
|
|
||||||
};
|
|
|
@ -6,7 +6,6 @@ var Gamepad = require('../gamepad/GamepadManager');
|
||||||
var HitTest = require('./inc/HitTest');
|
var HitTest = require('./inc/HitTest');
|
||||||
var Keyboard = require('../keyboard/KeyboardManager');
|
var Keyboard = require('../keyboard/KeyboardManager');
|
||||||
var Mouse = require('../mouse/MouseManager');
|
var Mouse = require('../mouse/MouseManager');
|
||||||
var MouseEvent = require('../mouse/events/');
|
|
||||||
var Pointer = require('../Pointer');
|
var Pointer = require('../Pointer');
|
||||||
var Touch = require('../touch/TouchManager');
|
var Touch = require('../touch/TouchManager');
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
var Class = require('../../../utils/Class');
|
var Class = require('../../../utils/Class');
|
||||||
var GetFastValue = require('../../../utils/object/GetFastValue');
|
var GetFastValue = require('../../../utils/object/GetFastValue');
|
||||||
var KeyComboMatchEvent = require('./KeyComboMatchEvent');
|
|
||||||
var ProcessKeyCombo = require('./ProcessKeyCombo');
|
var ProcessKeyCombo = require('./ProcessKeyCombo');
|
||||||
var ResetKeyCombo = require('./ResetKeyCombo');
|
var ResetKeyCombo = require('./ResetKeyCombo');
|
||||||
|
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var KeyComboMatchEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function KeyComboMatchEvent (keyCombo, keyboardEvent)
|
|
||||||
{
|
|
||||||
Event.call(this, 'KEY_COMBO_MATCH_EVENT');
|
|
||||||
|
|
||||||
this.data = keyCombo;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = KeyComboMatchEvent;
|
|
|
@ -1,19 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var KeyDownEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function KeyDownEvent (keyboardEvent)
|
|
||||||
{
|
|
||||||
Event.call(this, 'KEY_DOWN_EVENT');
|
|
||||||
|
|
||||||
this.data = keyboardEvent;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = KeyDownEvent;
|
|
|
@ -1,19 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var KeyUpEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function KeyUpEvent (keyboardEvent)
|
|
||||||
{
|
|
||||||
Event.call(this, 'KEY_UP_EVENT');
|
|
||||||
|
|
||||||
this.data = keyboardEvent;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = KeyUpEvent;
|
|
|
@ -1,43 +0,0 @@
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
var KeyCodes = require('./../keys/KeyCodes');
|
|
||||||
|
|
||||||
var events = {
|
|
||||||
KEY_DOWN_EVENT: require('./KeyDownEvent'),
|
|
||||||
KEY_UP_EVENT: require('./KeyUpEvent'),
|
|
||||||
_UP: [],
|
|
||||||
_DOWN: []
|
|
||||||
};
|
|
||||||
|
|
||||||
function createKeyEvent (type)
|
|
||||||
{
|
|
||||||
var KeyEvent = function (keyboardEvent)
|
|
||||||
{
|
|
||||||
Event.call(this, type);
|
|
||||||
|
|
||||||
this.data = keyboardEvent;
|
|
||||||
};
|
|
||||||
|
|
||||||
KeyEvent.prototype = Object.create(Event.prototype);
|
|
||||||
KeyEvent.prototype.constructor = KeyEvent;
|
|
||||||
|
|
||||||
return KeyEvent;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Inject the KeyCode events
|
|
||||||
|
|
||||||
for (var code in KeyCodes)
|
|
||||||
{
|
|
||||||
// The Key Down Event Types
|
|
||||||
|
|
||||||
var downType = 'KEY_DOWN_' + code;
|
|
||||||
var upType = 'KEY_UP_' + code;
|
|
||||||
|
|
||||||
events._DOWN[KeyCodes[code]] = createKeyEvent(downType);
|
|
||||||
events._UP[KeyCodes[code]] = createKeyEvent(upType);
|
|
||||||
|
|
||||||
// More friendly aliases to the main events
|
|
||||||
events[downType] = events._DOWN[KeyCodes[code]];
|
|
||||||
events[upType] = events._UP[KeyCodes[code]];
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = events;
|
|
|
@ -1,39 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var DragEndEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function DragEndEvent (pointer, gameObject, dropped)
|
|
||||||
{
|
|
||||||
Event.call(this, 'DRAG_END_EVENT');
|
|
||||||
|
|
||||||
// The Pointer that triggered the event
|
|
||||||
this.pointer = pointer;
|
|
||||||
|
|
||||||
// The native DOM event (MouseEvent, TouchEvent, etc)
|
|
||||||
this.event = pointer.event;
|
|
||||||
|
|
||||||
// The Game Object the event occurred on
|
|
||||||
this.gameObject = gameObject;
|
|
||||||
|
|
||||||
// The camera on which the input event occurred
|
|
||||||
this.camera = pointer.camera;
|
|
||||||
|
|
||||||
// The local x/y coordinates of the event within the Game Object
|
|
||||||
this.x = pointer.x;
|
|
||||||
this.y = pointer.y;
|
|
||||||
|
|
||||||
// When the drag ended did it fire a successful DROP event first?
|
|
||||||
this.dropped = dropped;
|
|
||||||
|
|
||||||
this.dragX = gameObject.input.dragX;
|
|
||||||
this.dragY = gameObject.input.dragY;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = DragEndEvent;
|
|
|
@ -1,32 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var DragEnterEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function DragEnterEvent (pointer, gameObject, dropZone)
|
|
||||||
{
|
|
||||||
Event.call(this, 'DRAG_ENTER_EVENT');
|
|
||||||
|
|
||||||
// The Pointer that triggered the event
|
|
||||||
this.pointer = pointer;
|
|
||||||
|
|
||||||
// The native DOM event (MouseEvent, TouchEvent, etc)
|
|
||||||
this.event = pointer.event;
|
|
||||||
|
|
||||||
// The Game Object the event occurred on
|
|
||||||
this.gameObject = gameObject;
|
|
||||||
|
|
||||||
// The camera on which the input event occurred
|
|
||||||
this.camera = pointer.camera;
|
|
||||||
|
|
||||||
// The drop zone the game object was dropped on
|
|
||||||
this.dropZone = dropZone;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = DragEnterEvent;
|
|
|
@ -1,37 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var DragEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function DragEvent (pointer, gameObject)
|
|
||||||
{
|
|
||||||
Event.call(this, 'DRAG_EVENT');
|
|
||||||
|
|
||||||
// The Pointer that triggered the event
|
|
||||||
this.pointer = pointer;
|
|
||||||
|
|
||||||
// The native DOM event (MouseEvent, TouchEvent, etc)
|
|
||||||
this.event = pointer.event;
|
|
||||||
|
|
||||||
// The Game Object the event occurred on
|
|
||||||
this.gameObject = gameObject;
|
|
||||||
|
|
||||||
// The camera on which the input event occurred
|
|
||||||
this.camera = pointer.camera;
|
|
||||||
|
|
||||||
// The local x/y coordinates of the event within the Game Object
|
|
||||||
this.x = pointer.x;
|
|
||||||
this.y = pointer.y;
|
|
||||||
|
|
||||||
// The local x/y coordinates of the event within the Game Object
|
|
||||||
this.dragX = pointer.x - gameObject.input.dragX;
|
|
||||||
this.dragY = pointer.y - gameObject.input.dragY;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = DragEvent;
|
|
|
@ -1,32 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var DragLeaveEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function DragLeaveEvent (pointer, gameObject, dropZone)
|
|
||||||
{
|
|
||||||
Event.call(this, 'DRAG_LEAVE_EVENT');
|
|
||||||
|
|
||||||
// The Pointer that triggered the event
|
|
||||||
this.pointer = pointer;
|
|
||||||
|
|
||||||
// The native DOM event (MouseEvent, TouchEvent, etc)
|
|
||||||
this.event = pointer.event;
|
|
||||||
|
|
||||||
// The Game Object the event occurred on
|
|
||||||
this.gameObject = gameObject;
|
|
||||||
|
|
||||||
// The camera on which the input event occurred
|
|
||||||
this.camera = pointer.camera;
|
|
||||||
|
|
||||||
// The drop zone the game object was dropped on
|
|
||||||
this.dropZone = dropZone;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = DragLeaveEvent;
|
|
|
@ -1,32 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var DragOverEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function DragOverEvent (pointer, gameObject, dropZone)
|
|
||||||
{
|
|
||||||
Event.call(this, 'DRAG_OVER_EVENT');
|
|
||||||
|
|
||||||
// The Pointer that triggered the event
|
|
||||||
this.pointer = pointer;
|
|
||||||
|
|
||||||
// The native DOM event (MouseEvent, TouchEvent, etc)
|
|
||||||
this.event = pointer.event;
|
|
||||||
|
|
||||||
// The Game Object the event occurred on
|
|
||||||
this.gameObject = gameObject;
|
|
||||||
|
|
||||||
// The camera on which the input event occurred
|
|
||||||
this.camera = pointer.camera;
|
|
||||||
|
|
||||||
// The drop zone the game object was dropped on
|
|
||||||
this.dropZone = dropZone;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = DragOverEvent;
|
|
|
@ -1,36 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var DragStartEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function DragStartEvent (pointer, gameObject)
|
|
||||||
{
|
|
||||||
Event.call(this, 'DRAG_START_EVENT');
|
|
||||||
|
|
||||||
// The Pointer that triggered the event
|
|
||||||
this.pointer = pointer;
|
|
||||||
|
|
||||||
// The native DOM event (MouseEvent, TouchEvent, etc)
|
|
||||||
this.event = pointer.event;
|
|
||||||
|
|
||||||
// The Game Object the event occurred on
|
|
||||||
this.gameObject = gameObject;
|
|
||||||
|
|
||||||
// The camera on which the input event occurred
|
|
||||||
this.camera = pointer.camera;
|
|
||||||
|
|
||||||
// The local x/y coordinates of the event within the Game Object
|
|
||||||
this.x = pointer.x;
|
|
||||||
this.y = pointer.y;
|
|
||||||
|
|
||||||
this.dragX = gameObject.input.dragX;
|
|
||||||
this.dragY = gameObject.input.dragY;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = DragStartEvent;
|
|
|
@ -1,32 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var DropEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function DropEvent (pointer, gameObject, dropZone)
|
|
||||||
{
|
|
||||||
Event.call(this, 'DROP_EVENT');
|
|
||||||
|
|
||||||
// The Pointer that triggered the event
|
|
||||||
this.pointer = pointer;
|
|
||||||
|
|
||||||
// The native DOM event (MouseEvent, TouchEvent, etc)
|
|
||||||
this.event = pointer.event;
|
|
||||||
|
|
||||||
// The Game Object the event occurred on
|
|
||||||
this.gameObject = gameObject;
|
|
||||||
|
|
||||||
// The camera on which the input event occurred
|
|
||||||
this.camera = pointer.camera;
|
|
||||||
|
|
||||||
// The drop zone the game object was dropped on
|
|
||||||
this.dropZone = dropZone;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = DropEvent;
|
|
|
@ -1,33 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var GameObjectDownEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function GameObjectDownEvent (pointer, gameObject)
|
|
||||||
{
|
|
||||||
Event.call(this, 'GAME_OBJECT_DOWN_EVENT');
|
|
||||||
|
|
||||||
// The Pointer that triggered the event
|
|
||||||
this.pointer = pointer;
|
|
||||||
|
|
||||||
// The native DOM event (MouseEvent, TouchEvent, etc)
|
|
||||||
this.event = pointer.event;
|
|
||||||
|
|
||||||
// The Game Object the event occurred on
|
|
||||||
this.gameObject = gameObject;
|
|
||||||
|
|
||||||
// The camera on which the input event occurred
|
|
||||||
this.camera = pointer.camera;
|
|
||||||
|
|
||||||
// The local x/y coordinates of the event within the Game Object
|
|
||||||
this.x = gameObject.input.localX;
|
|
||||||
this.y = gameObject.input.localY;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = GameObjectDownEvent;
|
|
|
@ -1,33 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var GameObjectMoveEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function GameObjectMoveEvent (pointer, gameObject)
|
|
||||||
{
|
|
||||||
Event.call(this, 'GAME_OBJECT_MOVE_EVENT');
|
|
||||||
|
|
||||||
// The Pointer that triggered the event
|
|
||||||
this.pointer = pointer;
|
|
||||||
|
|
||||||
// The native DOM event (MouseEvent, TouchEvent, etc)
|
|
||||||
this.event = pointer.event;
|
|
||||||
|
|
||||||
// The Game Object the event occurred on
|
|
||||||
this.gameObject = gameObject;
|
|
||||||
|
|
||||||
// The camera on which the input event occurred
|
|
||||||
this.camera = pointer.camera;
|
|
||||||
|
|
||||||
// The local x/y coordinates of the event within the Game Object
|
|
||||||
this.x = gameObject.input.localX;
|
|
||||||
this.y = gameObject.input.localY;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = GameObjectMoveEvent;
|
|
|
@ -1,29 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var GameObjectOutEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function GameObjectOutEvent (pointer, gameObject)
|
|
||||||
{
|
|
||||||
Event.call(this, 'GAME_OBJECT_OUT_EVENT');
|
|
||||||
|
|
||||||
// The Pointer that triggered the event
|
|
||||||
this.pointer = pointer;
|
|
||||||
|
|
||||||
// The native DOM event (MouseEvent, TouchEvent, etc)
|
|
||||||
this.event = pointer.event;
|
|
||||||
|
|
||||||
// The Game Object the event occurred on
|
|
||||||
this.gameObject = gameObject;
|
|
||||||
|
|
||||||
// The camera on which the input event occurred
|
|
||||||
this.camera = pointer.camera;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = GameObjectOutEvent;
|
|
|
@ -1,33 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var GameObjectOverEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function GameObjectOverEvent (pointer, gameObject)
|
|
||||||
{
|
|
||||||
Event.call(this, 'GAME_OBJECT_OVER_EVENT');
|
|
||||||
|
|
||||||
// The Pointer that triggered the event
|
|
||||||
this.pointer = pointer;
|
|
||||||
|
|
||||||
// The native DOM event (MouseEvent, TouchEvent, etc)
|
|
||||||
this.event = pointer.event;
|
|
||||||
|
|
||||||
// The Game Object the event occurred on
|
|
||||||
this.gameObject = gameObject;
|
|
||||||
|
|
||||||
// The camera on which the input event occurred
|
|
||||||
this.camera = pointer.camera;
|
|
||||||
|
|
||||||
// The local x/y coordinates of the event within the Game Object
|
|
||||||
this.x = gameObject.input.localX;
|
|
||||||
this.y = gameObject.input.localY;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = GameObjectOverEvent;
|
|
|
@ -1,33 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var GameObjectUpEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function GameObjectUpEvent (pointer, gameObject)
|
|
||||||
{
|
|
||||||
Event.call(this, 'GAME_OBJECT_UP_EVENT');
|
|
||||||
|
|
||||||
// The Pointer that triggered the event
|
|
||||||
this.pointer = pointer;
|
|
||||||
|
|
||||||
// The native DOM event (MouseEvent, TouchEvent, etc)
|
|
||||||
this.event = pointer.event;
|
|
||||||
|
|
||||||
// The Game Object the event occurred on
|
|
||||||
this.gameObject = gameObject;
|
|
||||||
|
|
||||||
// The camera on which the input event occurred
|
|
||||||
this.camera = pointer.camera;
|
|
||||||
|
|
||||||
// The local x/y coordinates of the event within the Game Object
|
|
||||||
this.x = gameObject.input.localX;
|
|
||||||
this.y = gameObject.input.localY;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = GameObjectUpEvent;
|
|
|
@ -1,39 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var PointerDownEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function PointerDownEvent (pointer, gameObjects)
|
|
||||||
{
|
|
||||||
Event.call(this, 'POINTER_DOWN_EVENT');
|
|
||||||
|
|
||||||
// The Pointer that triggered the event
|
|
||||||
this.pointer = pointer;
|
|
||||||
|
|
||||||
// The native DOM event (MouseEvent, TouchEvent, etc)
|
|
||||||
this.event = pointer.event;
|
|
||||||
|
|
||||||
// The camera on which the input event occurred
|
|
||||||
this.camera = pointer.camera;
|
|
||||||
|
|
||||||
// The x/y coordinates of the event
|
|
||||||
this.x = pointer.x;
|
|
||||||
this.y = pointer.y;
|
|
||||||
|
|
||||||
// An array of all the game objects the pointer event occurred on in display list order.
|
|
||||||
// Will be empty if no objects were interacted with.
|
|
||||||
// If populated, the bottom element (list[0]) is the highest object on the display list.
|
|
||||||
// If InputManager.topOnly is true this array will only contain one element.
|
|
||||||
this.list = gameObjects;
|
|
||||||
|
|
||||||
// A reference to the top-most object on the display list (same as event.list[0])
|
|
||||||
this.gameObject = gameObjects[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = PointerDownEvent;
|
|
|
@ -1,39 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var PointerMoveEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function PointerMoveEvent (pointer, gameObjects)
|
|
||||||
{
|
|
||||||
Event.call(this, 'POINTER_MOVE_EVENT');
|
|
||||||
|
|
||||||
// The Pointer that triggered the event
|
|
||||||
this.pointer = pointer;
|
|
||||||
|
|
||||||
// The native DOM event (MouseEvent, TouchEvent, etc)
|
|
||||||
this.event = pointer.event;
|
|
||||||
|
|
||||||
// The camera on which the input event occurred
|
|
||||||
this.camera = pointer.camera;
|
|
||||||
|
|
||||||
// The x/y coordinates of the event
|
|
||||||
this.x = pointer.x;
|
|
||||||
this.y = pointer.y;
|
|
||||||
|
|
||||||
// An array of all the game objects the pointer event occurred on in display list order.
|
|
||||||
// Will be empty if no objects were interacted with.
|
|
||||||
// If populated, the bottom element (list[0]) is the highest object on the display list.
|
|
||||||
// If InputManager.topOnly is true this array will only contain one element.
|
|
||||||
this.list = gameObjects;
|
|
||||||
|
|
||||||
// A reference to the top-most object on the display list (also this.list[0]). Undefined if there isn't any.
|
|
||||||
this.gameObject = gameObjects[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = PointerMoveEvent;
|
|
|
@ -1,39 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var PointerOutEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function PointerOutEvent (pointer, gameObjects)
|
|
||||||
{
|
|
||||||
Event.call(this, 'POINTER_OUT_EVENT');
|
|
||||||
|
|
||||||
// The Pointer that triggered the event
|
|
||||||
this.pointer = pointer;
|
|
||||||
|
|
||||||
// The native DOM event (MouseEvent, TouchEvent, etc)
|
|
||||||
this.event = pointer.event;
|
|
||||||
|
|
||||||
// The camera on which the input event occurred
|
|
||||||
this.camera = pointer.camera;
|
|
||||||
|
|
||||||
// The x/y coordinates of the event
|
|
||||||
this.x = pointer.x;
|
|
||||||
this.y = pointer.y;
|
|
||||||
|
|
||||||
// An array of all the game objects the pointer event occurred on in display list order.
|
|
||||||
// Will be undefined if no objects were interacted with.
|
|
||||||
// If populated, the bottom element (list[0]) is the highest object on the display list.
|
|
||||||
// If InputManager.topOnly is true this array will only contain one element.
|
|
||||||
this.list = gameObjects;
|
|
||||||
|
|
||||||
// A reference to the top-most object on the display list (also this.list[0])
|
|
||||||
this.gameObject = gameObjects[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = PointerOutEvent;
|
|
|
@ -1,39 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var PointerOverEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function PointerOverEvent (pointer, gameObjects)
|
|
||||||
{
|
|
||||||
Event.call(this, 'POINTER_OVER_EVENT');
|
|
||||||
|
|
||||||
// The Pointer that triggered the event
|
|
||||||
this.pointer = pointer;
|
|
||||||
|
|
||||||
// The native DOM event (MouseEvent, TouchEvent, etc)
|
|
||||||
this.event = pointer.event;
|
|
||||||
|
|
||||||
// The camera on which the input event occurred
|
|
||||||
this.camera = pointer.camera;
|
|
||||||
|
|
||||||
// The x/y coordinates of the event
|
|
||||||
this.x = pointer.x;
|
|
||||||
this.y = pointer.y;
|
|
||||||
|
|
||||||
// An array of all the game objects the pointer event occurred on in display list order.
|
|
||||||
// Will be undefined if no objects were interacted with.
|
|
||||||
// If populated, the bottom element (list[0]) is the highest object on the display list.
|
|
||||||
// If InputManager.topOnly is true this array will only contain one element.
|
|
||||||
this.list = gameObjects;
|
|
||||||
|
|
||||||
// A reference to the top-most object on the display list (also this.list[0])
|
|
||||||
this.gameObject = gameObjects[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = PointerOverEvent;
|
|
|
@ -1,39 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var PointerUpEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function PointerUpEvent (pointer, gameObjects)
|
|
||||||
{
|
|
||||||
Event.call(this, 'POINTER_UP_EVENT');
|
|
||||||
|
|
||||||
// The Pointer that triggered the event
|
|
||||||
this.pointer = pointer;
|
|
||||||
|
|
||||||
// The native DOM event (MouseEvent, TouchEvent, etc)
|
|
||||||
this.event = pointer.event;
|
|
||||||
|
|
||||||
// The camera on which the input event occurred
|
|
||||||
this.camera = pointer.camera;
|
|
||||||
|
|
||||||
// The x/y coordinates of the event
|
|
||||||
this.x = pointer.x;
|
|
||||||
this.y = pointer.y;
|
|
||||||
|
|
||||||
// An array of all the game objects the pointer event occurred on in display list order.
|
|
||||||
// Will be empty if no objects were interacted with.
|
|
||||||
// If populated, the bottom element (list[0]) is the highest object on the display list.
|
|
||||||
// If InputManager.topOnly is true this array will only contain one element.
|
|
||||||
this.list = gameObjects;
|
|
||||||
|
|
||||||
// A reference to the top-most object on the display list (same as event.list[0])
|
|
||||||
this.gameObject = gameObjects[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = PointerUpEvent;
|
|
|
@ -1,25 +0,0 @@
|
||||||
// Phaser.Input.Events
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
|
|
||||||
DRAG: require('./DragEvent'),
|
|
||||||
DRAG_END: require('./DragEndEvent'),
|
|
||||||
DRAG_ENTER: require('./DragEnterEvent'),
|
|
||||||
DRAG_LEAVE: require('./DragLeaveEvent'),
|
|
||||||
DRAG_OVER: require('./DragOverEvent'),
|
|
||||||
DRAG_START: require('./DragStartEvent'),
|
|
||||||
DROP: require('./DropEvent'),
|
|
||||||
|
|
||||||
GAME_OBJECT_DOWN: require('./GameObjectDownEvent'),
|
|
||||||
GAME_OBJECT_MOVE: require('./GameObjectMoveEvent'),
|
|
||||||
GAME_OBJECT_OUT: require('./GameObjectOutEvent'),
|
|
||||||
GAME_OBJECT_OVER: require('./GameObjectOverEvent'),
|
|
||||||
GAME_OBJECT_UP: require('./GameObjectUpEvent'),
|
|
||||||
|
|
||||||
POINTER_DOWN: require('./PointerDownEvent'),
|
|
||||||
POINTER_MOVE: require('./PointerMoveEvent'),
|
|
||||||
POINTER_OUT: require('./PointerOutEvent'),
|
|
||||||
POINTER_OVER: require('./PointerOverEvent'),
|
|
||||||
POINTER_UP: require('./PointerUpEvent')
|
|
||||||
|
|
||||||
};
|
|
|
@ -1,6 +1,5 @@
|
||||||
var Class = require('../../utils/Class');
|
var Class = require('../../utils/Class');
|
||||||
var Features = require('../../device/Features');
|
var Features = require('../../device/Features');
|
||||||
var MouseEvents = require('./events');
|
|
||||||
|
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent
|
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent
|
||||||
// https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md
|
// https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var MouseDownEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function MouseDownEvent (nativeEvent)
|
|
||||||
{
|
|
||||||
Event.call(this, 'MOUSE_DOWN_EVENT');
|
|
||||||
|
|
||||||
this.data = nativeEvent;
|
|
||||||
|
|
||||||
this.x = nativeEvent.clientX;
|
|
||||||
this.y = nativeEvent.clientY;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = MouseDownEvent;
|
|
|
@ -1,22 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var MouseMoveEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function MouseMoveEvent (nativeEvent)
|
|
||||||
{
|
|
||||||
Event.call(this, 'MOUSE_MOVE_EVENT');
|
|
||||||
|
|
||||||
this.data = nativeEvent;
|
|
||||||
|
|
||||||
this.x = nativeEvent.clientX;
|
|
||||||
this.y = nativeEvent.clientY;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = MouseMoveEvent;
|
|
|
@ -1,22 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var MouseUpEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function MouseUpEvent (nativeEvent)
|
|
||||||
{
|
|
||||||
Event.call(this, 'MOUSE_UP_EVENT');
|
|
||||||
|
|
||||||
this.data = nativeEvent;
|
|
||||||
|
|
||||||
this.x = nativeEvent.clientX;
|
|
||||||
this.y = nativeEvent.clientY;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = MouseUpEvent;
|
|
|
@ -1,20 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var PointerLockChangeEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function PointerLockChangeEvent (nativeEvent, isPointerLocked)
|
|
||||||
{
|
|
||||||
Event.call(this, 'POINTER_LOCK_CHANGE_EVENT');
|
|
||||||
|
|
||||||
this.data = nativeEvent;
|
|
||||||
this.isPointerLocked = isPointerLocked;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = PointerLockChangeEvent;
|
|
|
@ -1,8 +0,0 @@
|
||||||
// Phaser.Input.Mouse.Events
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
DOWN: require('./MouseDownEvent'),
|
|
||||||
UP: require('./MouseUpEvent'),
|
|
||||||
MOVE: require('./MouseMoveEvent'),
|
|
||||||
POINTER_LOCK_CHANGE: require('./PointerLockChangeEvent')
|
|
||||||
};
|
|
|
@ -1,19 +0,0 @@
|
||||||
var Class = require('../../utils/Class');
|
|
||||||
var Event = require('../../events/Event');
|
|
||||||
|
|
||||||
var LoaderCompleteEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function LoaderCompleteEvent (loader)
|
|
||||||
{
|
|
||||||
Event.call(this, 'LOADER_COMPLETE_EVENT');
|
|
||||||
|
|
||||||
this.loader = loader;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = LoaderCompleteEvent;
|
|
|
@ -1,19 +0,0 @@
|
||||||
var Class = require('../../utils/Class');
|
|
||||||
var Event = require('../../events/Event');
|
|
||||||
|
|
||||||
var LoaderStartEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function LoaderStartEvent (loader)
|
|
||||||
{
|
|
||||||
Event.call(this, 'LOADER_START_EVENT');
|
|
||||||
|
|
||||||
this.loader = loader;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = LoaderStartEvent;
|
|
|
@ -1,6 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
|
|
||||||
LOADER_START_EVENT: require('./LoaderStartEvent'),
|
|
||||||
LOADER_COMPLETE_EVENT: require('./LoaderCompleteEvent')
|
|
||||||
|
|
||||||
};
|
|
|
@ -15,6 +15,8 @@ var Phaser = {
|
||||||
|
|
||||||
DOM: require('./dom/'),
|
DOM: require('./dom/'),
|
||||||
|
|
||||||
|
EventEmitter: require('./events/EventEmitter'),
|
||||||
|
|
||||||
Game: require('./boot/Game'),
|
Game: require('./boot/Game'),
|
||||||
|
|
||||||
Math: require('./math'),
|
Math: require('./math'),
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var ArcadePhysicsCollideEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function ArcadePhysicsCollideEvent (gameObjectA, gameObjectB)
|
|
||||||
{
|
|
||||||
Event.call(this, 'ARCADE_COLLIDE_EVENT');
|
|
||||||
|
|
||||||
this.gameObjectA = gameObjectA;
|
|
||||||
|
|
||||||
this.gameObjectB = gameObjectB;
|
|
||||||
|
|
||||||
this.bodyA = gameObjectA.body;
|
|
||||||
|
|
||||||
this.bodyB = gameObjectB.body;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = ArcadePhysicsCollideEvent;
|
|
|
@ -1,25 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var ArcadePhysicsOverlapEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function ArcadePhysicsOverlapEvent (gameObjectA, gameObjectB)
|
|
||||||
{
|
|
||||||
Event.call(this, 'ARCADE_OVERLAP_EVENT');
|
|
||||||
|
|
||||||
this.gameObjectA = gameObjectA;
|
|
||||||
|
|
||||||
this.gameObjectB = gameObjectB;
|
|
||||||
|
|
||||||
this.bodyA = gameObjectA.body;
|
|
||||||
|
|
||||||
this.bodyB = gameObjectB.body;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = ArcadePhysicsOverlapEvent;
|
|
|
@ -1,26 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var ArcadePhysicsWorldBoundsEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function ArcadePhysicsWorldBoundsEvent (body)
|
|
||||||
{
|
|
||||||
Event.call(this, 'ARCADE_WORLD_BOUNDS_EVENT');
|
|
||||||
|
|
||||||
this.gameObject = body.gameObject;
|
|
||||||
|
|
||||||
this.body = body;
|
|
||||||
|
|
||||||
this.blockedUp = body.blocked.up;
|
|
||||||
this.blockedDown = body.blocked.down;
|
|
||||||
this.blockedLeft = body.blocked.left;
|
|
||||||
this.blockedRight = body.blocked.right;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = ArcadePhysicsWorldBoundsEvent;
|
|
|
@ -1,9 +0,0 @@
|
||||||
// Phaser.Physics.ArcadePhysics.Events
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
|
|
||||||
OVERLAP: require('./ArcadePhysicsOverlapEvent'),
|
|
||||||
COLLIDE: require('./ArcadePhysicsCollideEvent'),
|
|
||||||
WORLD_BOUNDS: require('./ArcadePhysicsWorldBoundsEvent')
|
|
||||||
|
|
||||||
};
|
|
|
@ -34,7 +34,7 @@ var CollideSpriteVsTilemapLayer = function (sprite, tilemapLayer, collideCallbac
|
||||||
|
|
||||||
if (TileIntersectsBody(tileWorldRect, body)
|
if (TileIntersectsBody(tileWorldRect, body)
|
||||||
&& (!processCallback || processCallback.call(callbackContext, sprite, tile))
|
&& (!processCallback || processCallback.call(callbackContext, sprite, tile))
|
||||||
&& ProcessTileCallbacks(tile)
|
&& ProcessTileCallbacks(tile, sprite)
|
||||||
&& (overlapOnly || SeparateTile(i, body, tile, tileWorldRect, tilemapLayer, this.TILE_BIAS)))
|
&& (overlapOnly || SeparateTile(i, body, tile, tileWorldRect, tilemapLayer, this.TILE_BIAS)))
|
||||||
{
|
{
|
||||||
this._total++;
|
this._total++;
|
||||||
|
@ -43,6 +43,15 @@ var CollideSpriteVsTilemapLayer = function (sprite, tilemapLayer, collideCallbac
|
||||||
{
|
{
|
||||||
collideCallback.call(callbackContext, sprite, tile);
|
collideCallback.call(callbackContext, sprite, tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (overlapOnly && body.onOverlap)
|
||||||
|
{
|
||||||
|
sprite.emit('overlap', body.gameObject, tile, body, null);
|
||||||
|
}
|
||||||
|
else if (body.onCollide)
|
||||||
|
{
|
||||||
|
sprite.emit('collide', body.gameObject, tile, body, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -87,7 +87,7 @@ var Separate = function (body1, body2, processCallback, callbackContext, overlap
|
||||||
}
|
}
|
||||||
else if (body1.onCollide || body2.onCollide)
|
else if (body1.onCollide || body2.onCollide)
|
||||||
{
|
{
|
||||||
this.emit('overlap', body1.gameObject, body2.gameObject, body1, body2);
|
this.emit('collide', body1.gameObject, body2.gameObject, body1, body2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,20 +1,18 @@
|
||||||
var ProcessTileCallbacks = function (tile)
|
var ProcessTileCallbacks = function (tile, sprite)
|
||||||
{
|
{
|
||||||
return true;
|
// Tile callbacks take priority over layer level callbacks
|
||||||
|
if (tile.collisionCallback)
|
||||||
|
{
|
||||||
|
return !tile.collisionCallback.call(tile.collisionCallbackContext, sprite, tile);
|
||||||
|
}
|
||||||
|
else if (tile.layer.callbacks[tile.index])
|
||||||
|
{
|
||||||
|
return !tile.layer.callbacks[tile.index].callback.call(
|
||||||
|
tile.layer.callbacks[tile.index].callbackContext, sprite, tile
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: port v2
|
return true;
|
||||||
// // Tilemap & tile callbacks take priority
|
|
||||||
// // A local callback always takes priority over a layer level callback
|
|
||||||
// if (tile.collisionCallback && !tile.collisionCallback.call(tile.collisionCallbackContext, body.sprite, tile))
|
|
||||||
// {
|
|
||||||
// // If it returns true then we can carry on, otherwise we should abort.
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// else if (typeof tile.layer.callbacks !== 'undefined' && tile.layer.callbacks[tile.index] && !tile.layer.callbacks[tile.index].callback.call(tile.layer.callbacks[tile.index].callbackContext, body.sprite, tile))
|
|
||||||
// {
|
|
||||||
// // If it returns true then we can carry on, otherwise we should abort.
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = ProcessTileCallbacks;
|
module.exports = ProcessTileCallbacks;
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var CollideEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function CollideEvent (bodyA, bodyB, axis)
|
|
||||||
{
|
|
||||||
Event.call(this, 'COLLIDE_EVENT');
|
|
||||||
|
|
||||||
// The first body involved in the collision]
|
|
||||||
this.bodyA = bodyA;
|
|
||||||
|
|
||||||
// The second body involved in the collision]
|
|
||||||
this.bodyB = bodyB;
|
|
||||||
|
|
||||||
// The Game Object associated with bodyA (if any)
|
|
||||||
this.gameObjectA = bodyA.gameObject;
|
|
||||||
|
|
||||||
// The Game Object associated with bodyB (if any)
|
|
||||||
this.gameObjectB = bodyB.gameObject;
|
|
||||||
|
|
||||||
// Either 'x' or 'y'
|
|
||||||
this.axis = axis;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = CollideEvent;
|
|
|
@ -1,7 +0,0 @@
|
||||||
// Phaser.Physics.Impact.Events
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
|
|
||||||
COLLIDE: require('./CollideEvent')
|
|
||||||
|
|
||||||
};
|
|
|
@ -10,22 +10,23 @@ var GetValue = require('../../utils/object/GetValue');
|
||||||
var MatterBody = require('./lib/body/Body');
|
var MatterBody = require('./lib/body/Body');
|
||||||
var MatterEvents = require('./lib/core/Events');
|
var MatterEvents = require('./lib/core/Events');
|
||||||
var MatterWorld = require('./lib/body/World');
|
var MatterWorld = require('./lib/body/World');
|
||||||
var PhysicsEvent = require('./events/');
|
|
||||||
|
|
||||||
var World = new Class({
|
var World = new Class({
|
||||||
|
|
||||||
|
Extends: EventEmitter,
|
||||||
|
|
||||||
initialize:
|
initialize:
|
||||||
|
|
||||||
function World (scene, config)
|
function World (scene, config)
|
||||||
{
|
{
|
||||||
|
EventEmitter.call(this);
|
||||||
|
|
||||||
this.scene = scene;
|
this.scene = scene;
|
||||||
|
|
||||||
this.engine = Engine.create(config);
|
this.engine = Engine.create(config);
|
||||||
|
|
||||||
this.localWorld = this.engine.world;
|
this.localWorld = this.engine.world;
|
||||||
|
|
||||||
this.events = new EventEmitter();
|
|
||||||
|
|
||||||
var gravity = GetValue(config, 'gravity', null);
|
var gravity = GetValue(config, 'gravity', null);
|
||||||
|
|
||||||
if (gravity)
|
if (gravity)
|
||||||
|
@ -87,35 +88,66 @@ var World = new Class({
|
||||||
|
|
||||||
setEventsProxy: function ()
|
setEventsProxy: function ()
|
||||||
{
|
{
|
||||||
var localEvents = this.events;
|
var _this = this;
|
||||||
|
var engine = this.engine;
|
||||||
|
|
||||||
MatterEvents.on(this.engine, 'beforeUpdate', function (event) {
|
MatterEvents.on(engine, 'beforeUpdate', function (event) {
|
||||||
|
|
||||||
localEvents.dispatch(new PhysicsEvent.BEFORE_UPDATE(event));
|
_this.emit('beforeupdate', event);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
MatterEvents.on(this.engine, 'afterUpdate', function (event) {
|
MatterEvents.on(engine, 'afterUpdate', function (event) {
|
||||||
|
|
||||||
localEvents.dispatch(new PhysicsEvent.AFTER_UPDATE(event));
|
_this.emit('afterupdate', event);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
MatterEvents.on(this.engine, 'collisionStart', function (event) {
|
MatterEvents.on(engine, 'collisionStart', function (event) {
|
||||||
|
|
||||||
localEvents.dispatch(new PhysicsEvent.COLLISION_START(event.pairs));
|
var pairs = event.pairs;
|
||||||
|
var bodyA;
|
||||||
|
var bodyB;
|
||||||
|
|
||||||
|
if (pairs.length > 0)
|
||||||
|
{
|
||||||
|
bodyA = pairs[0].bodyA;
|
||||||
|
bodyB = pairs[0].bodyB;
|
||||||
|
}
|
||||||
|
|
||||||
|
_this.emit('collisionstart', event, bodyA, bodyB);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
MatterEvents.on(this.engine, 'collisionActive', function (event) {
|
MatterEvents.on(engine, 'collisionActive', function (event) {
|
||||||
|
|
||||||
localEvents.dispatch(new PhysicsEvent.COLLISION_ACTIVE(event));
|
var pairs = event.pairs;
|
||||||
|
var bodyA;
|
||||||
|
var bodyB;
|
||||||
|
|
||||||
|
if (pairs.length > 0)
|
||||||
|
{
|
||||||
|
bodyA = pairs[0].bodyA;
|
||||||
|
bodyB = pairs[0].bodyB;
|
||||||
|
}
|
||||||
|
|
||||||
|
_this.emit('collisionactive', event, bodyA, bodyB);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
MatterEvents.on(this.engine, 'collisionEnd', function (event) {
|
MatterEvents.on(engine, 'collisionEnd', function (event) {
|
||||||
|
|
||||||
localEvents.dispatch(new PhysicsEvent.COLLISION_END(event));
|
var pairs = event.pairs;
|
||||||
|
var bodyA;
|
||||||
|
var bodyB;
|
||||||
|
|
||||||
|
if (pairs.length > 0)
|
||||||
|
{
|
||||||
|
bodyA = pairs[0].bodyA;
|
||||||
|
bodyB = pairs[0].bodyB;
|
||||||
|
}
|
||||||
|
|
||||||
|
_this.emit('collisionend', event, bodyA, bodyB);
|
||||||
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
var MatterEvents = require('../lib/core/Events');
|
var MatterEvents = require('../lib/core/Events');
|
||||||
var PhysicsEvent = require('../events/');
|
|
||||||
|
|
||||||
var Sleep = {
|
var Sleep = {
|
||||||
|
|
||||||
|
@ -24,10 +23,10 @@ var Sleep = {
|
||||||
{
|
{
|
||||||
if (value)
|
if (value)
|
||||||
{
|
{
|
||||||
var worldEvents = this.world.events;
|
var world = this.world;
|
||||||
|
|
||||||
MatterEvents.on(this.body, 'sleepStart', function (event) {
|
MatterEvents.on(this.body, 'sleepStart', function (event) {
|
||||||
worldEvents.dispatch(new PhysicsEvent.SLEEP_START(event, this));
|
world.emit('sleepstart', event, this);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -42,10 +41,10 @@ var Sleep = {
|
||||||
{
|
{
|
||||||
if (value)
|
if (value)
|
||||||
{
|
{
|
||||||
var worldEvents = this.world.events;
|
var world = this.world;
|
||||||
|
|
||||||
MatterEvents.on(this.body, 'sleepEnd', function (event) {
|
MatterEvents.on(this.body, 'sleepEnd', function (event) {
|
||||||
worldEvents.dispatch(new PhysicsEvent.SLEEP_END(event, this));
|
world.emit('sleepend', event, this);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var AfterUpdateEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function AfterUpdateEvent (event)
|
|
||||||
{
|
|
||||||
Event.call(this, 'AFTER_UPDATE_EVENT');
|
|
||||||
|
|
||||||
this.event = event;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = AfterUpdateEvent;
|
|
|
@ -1,19 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var BeforeUpdateEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function BeforeUpdateEvent (event)
|
|
||||||
{
|
|
||||||
Event.call(this, 'BEFORE_UPDATE_EVENT');
|
|
||||||
|
|
||||||
this.event = event;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = BeforeUpdateEvent;
|
|
|
@ -1,25 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var CollisionActiveEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function CollisionActiveEvent (pairs)
|
|
||||||
{
|
|
||||||
Event.call(this, 'COLLISION_ACTIVE_EVENT');
|
|
||||||
|
|
||||||
this.pairs = pairs;
|
|
||||||
|
|
||||||
if (pairs.pairs.length > 0)
|
|
||||||
{
|
|
||||||
this.bodyA = pairs.pairs[0].bodyA;
|
|
||||||
this.bodyB = pairs.pairs[0].bodyB;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = CollisionActiveEvent;
|
|
|
@ -1,25 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var CollisionEndEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function CollisionEndEvent (pairs)
|
|
||||||
{
|
|
||||||
Event.call(this, 'COLLISION_END_EVENT');
|
|
||||||
|
|
||||||
this.pairs = pairs;
|
|
||||||
|
|
||||||
if (pairs.pairs.length > 0)
|
|
||||||
{
|
|
||||||
this.bodyA = pairs.pairs[0].bodyA;
|
|
||||||
this.bodyB = pairs.pairs[0].bodyB;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = CollisionEndEvent;
|
|
|
@ -1,25 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var CollisionStartEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function CollisionStartEvent (pairs)
|
|
||||||
{
|
|
||||||
Event.call(this, 'COLLISION_START_EVENT');
|
|
||||||
|
|
||||||
this.pairs = pairs;
|
|
||||||
|
|
||||||
if (pairs.length > 0)
|
|
||||||
{
|
|
||||||
this.bodyA = pairs[0].bodyA;
|
|
||||||
this.bodyB = pairs[0].bodyB;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = CollisionStartEvent;
|
|
|
@ -1,19 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var SleepEndEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function SleepEndEvent (event, body)
|
|
||||||
{
|
|
||||||
Event.call(this, 'SLEEP_END_EVENT');
|
|
||||||
|
|
||||||
this.body = body;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = SleepEndEvent;
|
|
|
@ -1,20 +0,0 @@
|
||||||
var Class = require('../../../utils/Class');
|
|
||||||
var Event = require('../../../events/Event');
|
|
||||||
|
|
||||||
var SleepStartEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function SleepStartEvent (event, body)
|
|
||||||
{
|
|
||||||
Event.call(this, 'SLEEP_START_EVENT');
|
|
||||||
|
|
||||||
this.body = body;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = SleepStartEvent;
|
|
|
@ -1,13 +0,0 @@
|
||||||
// Phaser.Physics.Matter.Events
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
|
|
||||||
AFTER_UPDATE: require('./AfterUpdateEvent'),
|
|
||||||
BEFORE_UPDATE: require('./BeforeUpdateEvent'),
|
|
||||||
COLLISION_ACTIVE: require('./CollisionActiveEvent'),
|
|
||||||
COLLISION_END: require('./CollisionEndEvent'),
|
|
||||||
COLLISION_START: require('./CollisionStartEvent'),
|
|
||||||
SLEEP_END: require('./SleepEndEvent'),
|
|
||||||
SLEEP_START: require('./SleepStartEvent')
|
|
||||||
|
|
||||||
};
|
|
|
@ -1,5 +1,4 @@
|
||||||
var Class = require('../../utils/Class');
|
var Class = require('../../utils/Class');
|
||||||
var InputEvent = require('../../input/local/events');
|
|
||||||
var SceneInputManager = require('../../input/local/SceneInputManager');
|
var SceneInputManager = require('../../input/local/SceneInputManager');
|
||||||
|
|
||||||
var InputManager = new Class({
|
var InputManager = new Class({
|
||||||
|
@ -11,11 +10,6 @@ var InputManager = new Class({
|
||||||
function InputManager (scene)
|
function InputManager (scene)
|
||||||
{
|
{
|
||||||
SceneInputManager.call(this, scene);
|
SceneInputManager.call(this, scene);
|
||||||
},
|
|
||||||
|
|
||||||
pointScreenToWorldHitTest: function (gameObjects, x, y, camera)
|
|
||||||
{
|
|
||||||
return this.manager.pointScreenToWorldHitTest(gameObjects, x, y, camera);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
var Class = require('../utils/Class');
|
|
||||||
var Event = require('../events/Event');
|
|
||||||
|
|
||||||
var SoundEvent = new Class({
|
|
||||||
|
|
||||||
Extends: Event,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function SoundEvent (sound, type)
|
|
||||||
{
|
|
||||||
Event.call(this, type);
|
|
||||||
|
|
||||||
this.sound = sound;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = SoundEvent;
|
|
|
@ -1,19 +0,0 @@
|
||||||
var Class = require('../utils/Class');
|
|
||||||
var SoundEvent = require('./SoundEvent');
|
|
||||||
|
|
||||||
var SoundValueEvent = new Class({
|
|
||||||
|
|
||||||
Extends: SoundEvent,
|
|
||||||
|
|
||||||
initialize:
|
|
||||||
|
|
||||||
function SoundValueEvent (sound, type, value)
|
|
||||||
{
|
|
||||||
SoundEvent.call(this, sound, type);
|
|
||||||
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = SoundValueEvent;
|
|
|
@ -11,8 +11,6 @@ module.exports = {
|
||||||
WebAudioSoundManager: require('./webaudio/WebAudioSoundManager'),
|
WebAudioSoundManager: require('./webaudio/WebAudioSoundManager'),
|
||||||
|
|
||||||
HTML5AudioSound: require('./html5/HTML5AudioSound'),
|
HTML5AudioSound: require('./html5/HTML5AudioSound'),
|
||||||
HTML5AudioSoundManager: require('./html5/HTML5AudioSoundManager'),
|
HTML5AudioSoundManager: require('./html5/HTML5AudioSoundManager')
|
||||||
|
|
||||||
SoundEvent: require('./SoundEvent'),
|
|
||||||
SoundValueEvent: require('./SoundValueEvent')
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue