Skip to content

Commit 982823d

Browse files
committed
Updated TypeScript defs which now compiles against 1.2 (but still missing quite a few areas).
New build files that match them.
1 parent 8fff386 commit 982823d

6 files changed

Lines changed: 108 additions & 107 deletions

File tree

build/custom/phaser-no-libs.js

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* Phaser - http://www.phaser.io
99
*
10-
* v2.0.0 "Aes Sedai" - Built: Mon Mar 10 2014 02:30:54
10+
* v2.0.0 "Aes Sedai" - Built: Mon Mar 10 2014 11:07:14
1111
*
1212
* By Richard Davey http://www.photonstorm.com @photonstorm
1313
*
@@ -5759,15 +5759,19 @@ Phaser.Group = function (game, parent, name, addToStage) {
57595759
this.cursor = null;
57605760

57615761
/**
5762-
* @property {number} _cursorIndex - Internal pointer.
5763-
* @private
5762+
* @property {Phaser.Point} cameraOffset - If this object is fixedToCamera then this stores the x/y offset that its drawn at, from the top-left of the camera view.
57645763
*/
5765-
this._cursorIndex = 0;
5764+
this.cameraOffset = new Phaser.Point();
57665765

57675766
/**
5768-
* @property {Phaser.Point} cameraOffset - If this object is fixedToCamera then this stores the x/y offset that its drawn at, from the top-left of the camera view.
5767+
* @property {boolean} enableBody - If true all Sprites created with `Group.create` or `Group.createMulitple` will have a physics body created on them. Change the body type with `Group.physicsBodyType`.
57695768
*/
5770-
this.cameraOffset = new Phaser.Point();
5769+
this.enableBody = false;
5770+
5771+
/**
5772+
* @property {number} physicsBodyType - If Group.enableBody is true this is the type of physics body that is created on new Sprites. Phaser.Physics.ARCADE, Phaser.Physics.P2, Phaser.Physics.NINJA, etc.
5773+
*/
5774+
this.physicsBodyType = Phaser.Physics.ARCADE;
57715775

57725776
/**
57735777
* A small internal cache:
@@ -5779,10 +5783,11 @@ Phaser.Group = function (game, parent, name, addToStage) {
57795783
* 5 = outOfBoundsFired (0 = no, 1 = yes)
57805784
* 6 = exists (0 = no, 1 = yes)
57815785
* 7 = fixed to camera (0 = no, 1 = yes)
5786+
* 8 = cursor index
57825787
* @property {Int16Array} _cache
57835788
* @private
57845789
*/
5785-
this._cache = new Int16Array([0, 0, 0, 0, 1, 0, 1, 0]);
5790+
this._cache = new Int16Array([0, 0, 0, 0, 1, 0, 1, 0, 0]);
57865791

57875792
};
57885793

@@ -5935,6 +5940,22 @@ Phaser.Group.prototype.create = function (x, y, key, frame, exists) {
59355940
this.cursor = child;
59365941
}
59375942

5943+
if (this.enableBody)
5944+
{
5945+
if (this.physicsBodyType === Phaser.Physics.ARCADE)
5946+
{
5947+
child.body = new Phaser.Physics.Arcade.Body(child);
5948+
}
5949+
else if (this.physicsBodyType === Phaser.Physics.NINJA && this.game.physics.ninja)
5950+
{
5951+
child.body = new Phaser.Physics.Ninja.Body(this.game.physics.ninja, child, 1);
5952+
}
5953+
else if (this.physicsBodyType === Phaser.Physics.P2 && this.game.physics.p2)
5954+
{
5955+
child.body = new Phaser.Physics.P2.Body(this.game, child, x, y, 1);
5956+
}
5957+
}
5958+
59385959
return child;
59395960

59405961
}
@@ -5971,16 +5992,16 @@ Phaser.Group.prototype.next = function () {
59715992
if (this.cursor)
59725993
{
59735994
// Wrap the cursor?
5974-
if (this._cursorIndex === this.children.length)
5995+
if (this._cache[8] === this.children.length)
59755996
{
5976-
this._cursorIndex = 0;
5997+
this._cache[8] = 0;
59775998
}
59785999
else
59796000
{
5980-
this._cursorIndex++;
6001+
this._cache[8]++;
59816002
}
59826003

5983-
this.cursor = this.children[this._cursorIndex];
6004+
this.cursor = this.children[this._cache[8]];
59846005
}
59856006

59866007
}
@@ -5995,16 +6016,16 @@ Phaser.Group.prototype.previous = function () {
59956016
if (this.cursor)
59966017
{
59976018
// Wrap the cursor?
5998-
if (this._cursorIndex === 0)
6019+
if (this._cache[8] === 0)
59996020
{
6000-
this._cursorIndex = this.children.length - 1;
6021+
this._cache[8] = this.children.length - 1;
60016022
}
60026023
else
60036024
{
6004-
this._cursorIndex--;
6025+
this._cache[8]--;
60056026
}
60066027

6007-
this.cursor = this.children[this._cursorIndex];
6028+
this.cursor = this.children[this._cache[8]];
60086029
}
60096030

60106031
}
@@ -35120,7 +35141,7 @@ Phaser.Physics.Arcade.prototype = {
3512035141
* A game object can only have 1 physics body active at any one time, and it can't be changed until the object is destroyed.
3512135142
*
3512235143
* @method Phaser.Physics.Arcade#enable
35123-
* @param {object|array|Phaser.Group} object - The game object to create the physics body on. Can also be an array of objects, a body will be created on every object in the array that has a body parameter.
35144+
* @param {object|array|Phaser.Group} object - The game object to create the physics body on. Can also be an array or Group of objects, a body will be created on every child that has a `body` property.
3512435145
* @param {boolean} [children=true] - Should a body be created on all children of this object? If true it will propagate down the display list.
3512535146
*/
3512635147
enable: function (object, children) {
@@ -35855,7 +35876,7 @@ Phaser.Physics.Arcade.prototype = {
3585535876
// This is special case code that handles things like horizontal moving platforms you can ride
3585635877
if (body2.moves)
3585735878
{
35858-
body1.x += body2.x - body2.preX;
35879+
body1.x += body2.x - body2.prev.x;
3585935880
}
3586035881
}
3586135882
else if (!body2.immovable)
@@ -35866,7 +35887,7 @@ Phaser.Physics.Arcade.prototype = {
3586635887
// This is special case code that handles things like horizontal moving platforms you can ride
3586735888
if (body1.moves)
3586835889
{
35869-
body2.x += body1.x - body1.preX;
35890+
body2.x += body1.x - body1.prev.x;
3587035891
}
3587135892
}
3587235893

build/custom/phaser-no-libs.min.js

Lines changed: 10 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/phaser.d.ts

Lines changed: 15 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -2521,21 +2521,13 @@ declare module Phaser {
25212521
class Arcade {
25222522
//constructor
25232523
constructor(game: Phaser.Game);
2524-
//static methods
2525-
static CIRCLE: number;
2526-
static POLYGON: number;
2527-
static RECT: number;
25282524
//members
2525+
bounds: Phaser.Rectangle;
25292526
game: Phaser.Game;
25302527
gravity: Phaser.Point;
25312528
maxLevels: number;
25322529
maxObjects: number;
25332530
quadTree: Phaser.QuadTree;
2534-
worldBottom: SAT.Box;
2535-
worldLeft: SAT.Box;
2536-
worldPolys: SAT.Polygon[];
2537-
worldRight: SAT.Box;
2538-
worldTop: SAT.Box;
25392531
//methods
25402532
accelerateToObject(displayObject: any, destination: any, speed?: number, xSpeedMax?: number, ySpeedMax?: number): number;
25412533
accelerateToPointer(displayObject: any, pointer: any, speed?: number, xSpeedMax?: number, ySpeedMax?: number): number;
@@ -2568,13 +2560,18 @@ declare module Phaser {
25682560

25692561
module Arcade {
25702562

2563+
class FaceChoices {
2564+
none: boolean;
2565+
any: boolean;
2566+
up: boolean;
2567+
down: boolean;
2568+
left: boolean;
2569+
right: boolean;
2570+
}
2571+
25712572
class Body {
25722573
//constructor
25732574
constructor(sprite: Phaser.Sprite);
2574-
//static members
2575-
static CIRCLE: number;
2576-
static POLYGON: number;
2577-
static RECT: number;
25782575
//members
25792576
acceleration: Phaser.Point;
25802577
allowGravity: boolean;
@@ -2583,23 +2580,21 @@ declare module Phaser {
25832580
angularAcceleration: number;
25842581
angularDrag: number;
25852582
angularVelocity: number;
2586-
blocked: FaceChoices;
25872583
bottom: number;
25882584
bounce: Phaser.Point;
25892585
checkCollision: FaceChoices;
25902586
collideCallback: any;
25912587
collideCallbackContext: any;
25922588
collideWorldBounds: boolean;
2593-
contacts: Phaser.Physics.Arcade.Body[];
25942589
customSeparateCallback: Function;
25952590
customSeparateContext: any;
2591+
drag: Phaser.Point;
25962592
facing: number;
25972593
game: Phaser.Game;
25982594
gravity: Phaser.Point;
25992595
height: number;
26002596
immovable: boolean;
26012597
left: number;
2602-
linearDamping: number;
26032598
mass: number;
26042599
maxAngular: number;
26052600
maxVelocity: Phaser.Point;
@@ -2608,14 +2603,13 @@ declare module Phaser {
26082603
offset: Phaser.Point;
26092604
overlapX: number;
26102605
overlapY: number;
2611-
polygon: SAT.Polygon;
26122606
preRotation: number;
26132607
preX: number;
26142608
preY: number;
2609+
prev: Phaser.Point;
26152610
rebound: boolean;
26162611
right: number;
26172612
rotation: number;
2618-
shape: any;
26192613
speed: number;
26202614
sprite: Phaser.Sprite;
26212615
top: number;
@@ -2626,55 +2620,19 @@ declare module Phaser {
26262620
x: number;
26272621
y: number;
26282622
//methods
2629-
add(v:SAT.Vector): void;
2630-
addContact(body: Phaser.Physics.Arcade.Body): boolean;
2631-
applyDamping(): void;
2632-
checkBlocked(): void;
2623+
checkWorldBounds(): void;
26332624
deltaX(): number;
26342625
deltaY(): number;
26352626
deltaZ(): number;
26362627
destroy(): void;
2637-
exchange(body: Phaser.Physics.Arcade.Body): void;
2638-
getDownwardForce(): number;
2639-
getUpwardForce(): number;
2640-
give(body: Phaser.Physics.Arcade.Body, response: SAT.Response): void;
2641-
hitBottom(body: Phaser.Physics.Arcade.Body, response: SAT.Response): void;
2642-
hitLeft(body: Phaser.Physics.Arcade.Body, response: SAT.Response): void;
2643-
hitRight(body: Phaser.Physics.Arcade.Body, response: SAT.Response): void;
2644-
hitTop(body: Phaser.Physics.Arcade.Body, response: SAT.Response): void;
2645-
inContact(body: Phaser.Physics.Arcade.Body): boolean;
2646-
integrateVelocity(): void;
2647-
onFloor(): boolean;
2648-
onWall(): boolean;
2649-
overlap(body: Phaser.Physics.Arcade.Body, response: SAT.Response): boolean;
26502628
postUpdate(): void;
26512629
preUpdate(): void;
2652-
processRebound(body: Phaser.Physics.Arcade.Body): void;
2653-
reboundCheck(x: number, y: number, rebound: boolean): void;
2654-
removeContact(body: Phaser.Physics.Arcade.Body): boolean;
2630+
setSize(width: number, height: number, offsetX: number, offsetY: number): void;
26552631
reset(full: boolean): void;
2656-
separate(body: Phaser.Physics.Arcade.Body, response: SAT.Response): boolean;
2657-
setCircle(radius: number, offsetX?: number, offsetY?: number): void;
2658-
setPolygon(points: any[]): void;
2659-
setRectangle(width?: number, height?: number, translateX?: number, translateY?: number): void;
2660-
split(body: Phaser.Physics.Arcade.Body, response: SAT.Response): void;
2661-
sub(v: SAT.Vector): void;
2662-
take(body: Phaser.Physics.Arcade.Body, response: SAT.Response): void;
2663-
translate(x: number, y: number): void;
2632+
update(): void;
26642633
updateBounds(): void;
26652634
updateScale(): void;
26662635
}
2667-
2668-
class FaceChoices {
2669-
none: boolean;
2670-
any: boolean;
2671-
up: boolean;
2672-
down: boolean;
2673-
left: boolean;
2674-
right: boolean;
2675-
x: number;
2676-
y: number;
2677-
}
26782636
}
26792637
}
26802638

0 commit comments

Comments
 (0)