Merge branch 'master' into rendering-cleanup

This commit is contained in:
Felipe Alfonso 2018-01-12 21:15:06 -03:00
commit 79805ac04f
79 changed files with 99 additions and 2089 deletions

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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')
};

View file

@ -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;

View file

@ -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;

View file

@ -1,6 +0,0 @@
module.exports = {
CACHE_ADD_EVENT: require('./CacheAddEvent'),
CACHE_REMOVE_EVENT: require('./CacheRemoveEvent')
};

View file

@ -1,5 +1,4 @@
var Class = require('../utils/Class');
var Event = require('../events/Event');
var EventEmitter = require('eventemitter3');
/**
@ -10,11 +9,11 @@ var Data = new Class({
initialize:
function Data (parent, eventDispatcher)
function Data (parent, eventEmitter)
{
this.parent = parent;
this.events = (eventDispatcher) ? eventDispatcher : new EventEmitter();
this.events = (eventEmitter) ? eventEmitter : new EventEmitter();
this.list = {};

View file

@ -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;

View file

@ -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;

View file

@ -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;

View 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;

View file

@ -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;

View file

@ -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;

View file

@ -1,7 +1,6 @@
// Phaser.Input.Gamepad.Axis
var Class = require('../../utils/Class');
var GamepadEvent = require('./events/');
var Axis = new Class({
@ -36,7 +35,7 @@ var Axis = new Class({
percentage = 0;
}
return percentage * (this.value > 0 ? 1 : -1);
return percentage * (this.value > 0 ? 1 : -1);
}
});

View file

@ -3,7 +3,6 @@
var Axis = require('./Axis');
var Button = require('./Button');
var Class = require('../../utils/Class');
var GamepadEvent = require('./events/');
var Gamepad = new Class({

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -1,8 +0,0 @@
// Phaser.Input.Gamepad.Events
module.exports = {
CONNECTED: require('./GamepadConnectedEvent'),
DISCONNECTED: require('./GamepadDisconnectedEvent'),
DOWN: require('./GamepadDownEvent'),
UP: require('./GamepadUpEvent')
};

View file

@ -6,7 +6,6 @@ var Gamepad = require('../gamepad/GamepadManager');
var HitTest = require('./inc/HitTest');
var Keyboard = require('../keyboard/KeyboardManager');
var Mouse = require('../mouse/MouseManager');
var MouseEvent = require('../mouse/events/');
var Pointer = require('../Pointer');
var Touch = require('../touch/TouchManager');

View file

@ -1,6 +1,5 @@
var Class = require('../../../utils/Class');
var GetFastValue = require('../../../utils/object/GetFastValue');
var KeyComboMatchEvent = require('./KeyComboMatchEvent');
var ProcessKeyCombo = require('./ProcessKeyCombo');
var ResetKeyCombo = require('./ResetKeyCombo');

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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')
};

View file

@ -1,6 +1,5 @@
var Class = require('../../utils/Class');
var Features = require('../../device/Features');
var MouseEvents = require('./events');
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent
// https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -1,8 +0,0 @@
// Phaser.Input.Mouse.Events
module.exports = {
DOWN: require('./MouseDownEvent'),
UP: require('./MouseUpEvent'),
MOVE: require('./MouseMoveEvent'),
POINTER_LOCK_CHANGE: require('./PointerLockChangeEvent')
};

View file

@ -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;

View file

@ -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;

View file

@ -1,6 +0,0 @@
module.exports = {
LOADER_START_EVENT: require('./LoaderStartEvent'),
LOADER_COMPLETE_EVENT: require('./LoaderCompleteEvent')
};

View file

@ -15,6 +15,8 @@ var Phaser = {
DOM: require('./dom/'),
EventEmitter: require('./events/EventEmitter'),
Game: require('./boot/Game'),
Math: require('./math'),

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -1,9 +0,0 @@
// Phaser.Physics.ArcadePhysics.Events
module.exports = {
OVERLAP: require('./ArcadePhysicsOverlapEvent'),
COLLIDE: require('./ArcadePhysicsCollideEvent'),
WORLD_BOUNDS: require('./ArcadePhysicsWorldBoundsEvent')
};

View file

@ -34,7 +34,7 @@ var CollideSpriteVsTilemapLayer = function (sprite, tilemapLayer, collideCallbac
if (TileIntersectsBody(tileWorldRect, body)
&& (!processCallback || processCallback.call(callbackContext, sprite, tile))
&& ProcessTileCallbacks(tile)
&& ProcessTileCallbacks(tile, sprite)
&& (overlapOnly || SeparateTile(i, body, tile, tileWorldRect, tilemapLayer, this.TILE_BIAS)))
{
this._total++;
@ -43,6 +43,15 @@ var CollideSpriteVsTilemapLayer = function (sprite, tilemapLayer, collideCallbac
{
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);
}
}
}
};

View file

@ -87,7 +87,7 @@ var Separate = function (body1, body2, processCallback, callbackContext, overlap
}
else if (body1.onCollide || body2.onCollide)
{
this.emit('overlap', body1.gameObject, body2.gameObject, body1, body2);
this.emit('collide', body1.gameObject, body2.gameObject, body1, body2);
}
}

View file

@ -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
// // 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;
// }
return true;
};
module.exports = ProcessTileCallbacks;

View file

@ -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;

View file

@ -1,7 +0,0 @@
// Phaser.Physics.Impact.Events
module.exports = {
COLLIDE: require('./CollideEvent')
};

View file

@ -10,22 +10,23 @@ var GetValue = require('../../utils/object/GetValue');
var MatterBody = require('./lib/body/Body');
var MatterEvents = require('./lib/core/Events');
var MatterWorld = require('./lib/body/World');
var PhysicsEvent = require('./events/');
var World = new Class({
Extends: EventEmitter,
initialize:
function World (scene, config)
{
EventEmitter.call(this);
this.scene = scene;
this.engine = Engine.create(config);
this.localWorld = this.engine.world;
this.events = new EventEmitter();
var gravity = GetValue(config, 'gravity', null);
if (gravity)
@ -87,35 +88,66 @@ var World = new Class({
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);
});
},

View file

@ -1,5 +1,4 @@
var MatterEvents = require('../lib/core/Events');
var PhysicsEvent = require('../events/');
var Sleep = {
@ -24,10 +23,10 @@ var Sleep = {
{
if (value)
{
var worldEvents = this.world.events;
var world = this.world;
MatterEvents.on(this.body, 'sleepStart', function (event) {
worldEvents.dispatch(new PhysicsEvent.SLEEP_START(event, this));
world.emit('sleepstart', event, this);
});
}
else
@ -42,10 +41,10 @@ var Sleep = {
{
if (value)
{
var worldEvents = this.world.events;
var world = this.world;
MatterEvents.on(this.body, 'sleepEnd', function (event) {
worldEvents.dispatch(new PhysicsEvent.SLEEP_END(event, this));
world.emit('sleepend', event, this);
});
}
else

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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')
};

View file

@ -1,5 +1,4 @@
var Class = require('../../utils/Class');
var InputEvent = require('../../input/local/events');
var SceneInputManager = require('../../input/local/SceneInputManager');
var InputManager = new Class({
@ -11,11 +10,6 @@ var InputManager = new Class({
function InputManager (scene)
{
SceneInputManager.call(this, scene);
},
pointScreenToWorldHitTest: function (gameObjects, x, y, camera)
{
return this.manager.pointScreenToWorldHitTest(gameObjects, x, y, camera);
}
});

View file

@ -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;

View file

@ -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;

View file

@ -11,8 +11,6 @@ module.exports = {
WebAudioSoundManager: require('./webaudio/WebAudioSoundManager'),
HTML5AudioSound: require('./html5/HTML5AudioSound'),
HTML5AudioSoundManager: require('./html5/HTML5AudioSoundManager'),
HTML5AudioSoundManager: require('./html5/HTML5AudioSoundManager')
SoundEvent: require('./SoundEvent'),
SoundValueEvent: require('./SoundValueEvent')
};