Added DOM entry point, and getFirst to Children.

This commit is contained in:
photonstorm 2017-02-02 16:55:02 +00:00
parent 298ae9454b
commit f7aa82a2ff
8 changed files with 56 additions and 3 deletions

View file

@ -1,4 +1,4 @@
var CHECKSUM = {
build: 'aa3d0db0-e7df-11e6-b8bf-6f3109a66e78'
build: 'e48d64f0-e961-11e6-b493-bd5de866985b'
};
module.exports = CHECKSUM;

View file

@ -170,6 +170,24 @@ Children.prototype = {
return this.list[randomIndex];
},
getFirst: function (property, value, startIndex, endIndex)
{
if (startIndex === undefined) { startIndex = 0; }
if (endIndex === undefined) { endIndex = this.list.length; }
for (var i = startIndex; i < endIndex; i++)
{
var child = this.list[i];
if (child[property] === value)
{
return child;
}
}
return null;
},
/**
* Returns all children in this Group.
*

View file

@ -15,7 +15,6 @@ var TouchAction = function (canvas, value)
canvas.style['touch-action'] = value;
return canvas;
};
module.exports = TouchAction;

15
v3/src/dom/index.js Normal file
View file

@ -0,0 +1,15 @@
module.exports = {
AddEventListener: require('./AddEventListener'),
AddToDOM: require('./AddToDOM'),
CanvasInterpolation: require('./CanvasInterpolation'),
CanvasPool: require('./CanvasPool'),
DOMContentLoaded: require('./DOMContentLoaded'),
ParseXML: require('./ParseXML'),
RemoveEventListener: require('./RemoveEventListener'),
RemoveFromDOM: require('./RemoveFromDOM'),
RequestAnimationFrame: require('./RequestAnimationFrame'),
TouchAction: require('./TouchAction'),
UserSelect: require('./UserSelect')
};

View file

@ -103,4 +103,9 @@ Blitter.prototype.createMultiple = function (quantity, frame, visible)
return bobs;
};
Blitter.prototype.clear = function ()
{
this.children.removeAll();
};
module.exports = Blitter;

View file

@ -7,6 +7,13 @@ var Bob = function (blitter, x, y, frame, visible)
this.frame = frame;
this.visible = visible;
this.data = {};
reset: function (x, y, frame)
{
this.x = x;
this.y = y;
this.frame = frame;
}
};
module.exports = Bob;

View file

@ -7,6 +7,8 @@ var Extend = require('./utils/object/Extend');
var Phaser = {
DOM: require('./dom/'),
Game: require('./boot/Game'),
Event: require('./events/Event'),
@ -33,7 +35,8 @@ var Phaser = {
Utils: {
Array: require('./utils/array/'),
Objects: require('./utils/object/')
Objects: require('./utils/object/'),
String: require('./utils/string/')
}

View file

@ -0,0 +1,6 @@
module.exports = {
Pad: require('./Pad'),
Reverse: require('./Reverse')
};