Skip to content

Commit 4695f62

Browse files
committed
Merge branch 'photonstorm/097'
2 parents 6648cb3 + c647792 commit 4695f62

61 files changed

Lines changed: 34997 additions & 42104 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

GruntFile.js

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,23 @@ module.exports = function (grunt) {
5151
comments: true
5252
}
5353
},
54-
fx: {
55-
src: ['SpecialFX/**/*.ts'],
56-
dest: 'build/phaser-fx.js',
57-
options: {
58-
target: 'ES5',
59-
declaration: true,
60-
comments: true
61-
}
62-
}
54+
//tests: {
55+
// src: ['Tests/**/*.ts'],
56+
// options: {
57+
// target: 'ES5',
58+
// declaration: true,
59+
// comments: true
60+
// }
61+
// }
62+
//fx: {
63+
// src: ['SpecialFX/**/*.ts'],
64+
// dest: 'build/phaser-fx.js',
65+
// options: {
66+
// target: 'ES5',
67+
// declaration: true,
68+
// comments: true
69+
// }
70+
//}
6371
},
6472
copy: {
6573
main: {

Phaser/Game.ts

Lines changed: 12 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,6 @@ module Phaser {
8282
*/
8383
public _raf: RequestAnimationFrame;
8484

85-
/**
86-
* Max allowable accumulation.
87-
* @type {number}
88-
*/
89-
private _maxAccumulation: number = 32;
90-
91-
/**
92-
* Total number of milliseconds elapsed since last update loop.
93-
* @type {number}
94-
*/
95-
private _accumulator: number = 0;
96-
9785
/**
9886
* Milliseconds of time per step of the game loop.
9987
* @type {number}
@@ -231,6 +219,12 @@ module Phaser {
231219
*/
232220
public world: World;
233221

222+
/**
223+
* Reference to the physics manager.
224+
* @type {Physics.Manager}
225+
*/
226+
public physics: Physics.Manager;
227+
234228
/**
235229
* Instance of repeatable random data generator helper.
236230
* @type {RandomDataGenerator}
@@ -293,19 +287,20 @@ module Phaser {
293287
this.tweens = new TweenManager(this);
294288
this.input = new Input(this);
295289
this.rnd = new RandomDataGenerator([(Date.now() * Math.random()).toString()]);
290+
this.physics = new Physics.Manager(this);
296291

297292
this.setRenderer(Phaser.Types.RENDERER_CANVAS);
298293

299294
this.world.boot();
300295
this.stage.boot();
301296
this.input.boot();
302297

303-
this.framerate = 60;
304298
this.isBooted = true;
305299

306300
// Set-up some static helper references
307301
DebugUtils.game = this;
308302
ColorUtils.game = this;
303+
DebugUtils.context = this.stage.context;
309304

310305
// Display the default game screen?
311306
if (this.onInitCallback == null && this.onCreateCallback == null && this.onUpdateCallback == null && this.onRenderCallback == null && this._pendingState == null)
@@ -396,20 +391,8 @@ module Phaser {
396391
this.tweens.update();
397392
this.input.update();
398393
this.stage.update();
399-
400-
this._accumulator += this.time.delta;
401-
402-
if (this._accumulator > this._maxAccumulation)
403-
{
404-
this._accumulator = this._maxAccumulation;
405-
}
406-
407-
while (this._accumulator >= this._step)
408-
{
409-
this.time.elapsed = this.time.timeScale * (this._step / 1000);
410-
this.world.update();
411-
this._accumulator = this._accumulator - this._step;
412-
}
394+
this.physics.update();
395+
this.world.update();
413396

414397
if (this._loadComplete && this.onUpdateCallback)
415398
{
@@ -624,21 +607,6 @@ module Phaser {
624607

625608
}
626609

627-
public get framerate(): number {
628-
return 1000 / this._step;
629-
}
630-
631-
public set framerate(value: number) {
632-
633-
this._step = 1000 / value;
634-
635-
if (this._maxAccumulation < this._step)
636-
{
637-
this._maxAccumulation = this._step;
638-
}
639-
640-
}
641-
642610
/**
643611
* Checks for overlaps between two objects using the world QuadTree. Can be GameObject vs. GameObject, GameObject vs. Group or Group vs. Group.
644612
* Note: Does not take the objects scrollFactor into account. All overlaps are check in world space.
@@ -650,7 +618,8 @@ module Phaser {
650618
* @returns {boolean} true if the objects overlap, otherwise false.
651619
*/
652620
public collide(objectOrGroup1 = null, objectOrGroup2 = null, notifyCallback = null, context? = this.callbackContext): bool {
653-
return this.world.physics.overlap(objectOrGroup1, objectOrGroup2, notifyCallback, this.world.physics.separate, context);
621+
//return this.world.physics.overlap(objectOrGroup1, objectOrGroup2, notifyCallback, this.world.physics.separate, context);
622+
return false;
654623
}
655624

656625
public get camera(): Camera {

Phaser/Motion.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ module Phaser {
5252
* @param {number} maxTime Time given in milliseconds (1000 = 1 sec). If set the speed is adjusted so the source will arrive at destination in the given number of ms
5353
*/
5454
public moveTowardsObject(source: Sprite, dest: Sprite, speed: number = 60, maxTime: number = 0) {
55+
5556
var a: number = this.angleBetween(source, dest);
5657

5758
if (maxTime > 0)
@@ -79,6 +80,8 @@ module Phaser {
7980
* @param {number} ySpeedMax The maximum speed in pixels per second in which the sprite can move vertically
8081
*/
8182
public accelerateTowardsObject(source: Sprite, dest: Sprite, speed: number, xSpeedMax: number, ySpeedMax: number) {
83+
84+
/*
8285
var a: number = this.angleBetween(source, dest);
8386
8487
source.body.velocity.x = 0;
@@ -89,6 +92,7 @@ module Phaser {
8992
9093
source.body.maxVelocity.x = xSpeedMax;
9194
source.body.maxVelocity.y = ySpeedMax;
95+
*/
9296

9397
}
9498

@@ -103,6 +107,7 @@ module Phaser {
103107
* @param {number} maxTime Time given in milliseconds (1000 = 1 sec). If set the speed is adjusted so the source will arrive at destination in the given number of ms
104108
*/
105109
public moveTowardsMouse(source: Sprite, speed: number = 60, maxTime: number = 0) {
110+
106111
var a: number = this.angleBetweenMouse(source);
107112

108113
if (maxTime > 0)
@@ -129,6 +134,8 @@ module Phaser {
129134
* @param {number} ySpeedMax The maximum speed in pixels per second in which the sprite can move vertically
130135
*/
131136
public accelerateTowardsMouse(source: Sprite, speed: number, xSpeedMax: number, ySpeedMax: number) {
137+
138+
/*
132139
var a: number = this.angleBetweenMouse(source);
133140
134141
source.body.velocity.x = 0;
@@ -139,6 +146,8 @@ module Phaser {
139146
140147
source.body.maxVelocity.x = xSpeedMax;
141148
source.body.maxVelocity.y = ySpeedMax;
149+
*/
150+
142151
}
143152

144153
/**
@@ -153,6 +162,7 @@ module Phaser {
153162
* @param {number} maxTime Time given in milliseconds (1000 = 1 sec). If set the speed is adjusted so the source will arrive at destination in the given number of ms
154163
*/
155164
public moveTowardsPoint(source: Sprite, target: Point, speed: number = 60, maxTime: number = 0) {
165+
156166
var a: number = this.angleBetweenPoint(source, target);
157167

158168
if (maxTime > 0)
@@ -179,6 +189,8 @@ module Phaser {
179189
* @param {number} ySpeedMax The maximum speed in pixels per second in which the sprite can move vertically
180190
*/
181191
public accelerateTowardsPoint(source: Sprite, target: Point, speed: number, xSpeedMax: number, ySpeedMax: number) {
192+
193+
/*
182194
var a: number = this.angleBetweenPoint(source, target);
183195
184196
source.body.velocity.x = 0;
@@ -189,6 +201,8 @@ module Phaser {
189201
190202
source.body.maxVelocity.x = xSpeedMax;
191203
source.body.maxVelocity.y = ySpeedMax;
204+
*/
205+
192206
}
193207

194208
/**
@@ -240,6 +254,7 @@ module Phaser {
240254
* @return {number} The angle (in radians unless asDegrees is true)
241255
*/
242256
public angleBetweenPoint(a: Sprite, target: Point, asDegrees: bool = false): number {
257+
243258
var dx: number = (target.x) - (a.x + a.transform.origin.x);
244259
var dy: number = (target.y) - (a.y + a.transform.origin.y);
245260

@@ -251,6 +266,7 @@ module Phaser {
251266
{
252267
return Math.atan2(dy, dx);
253268
}
269+
254270
}
255271

256272
/**
@@ -287,6 +303,8 @@ module Phaser {
287303
* @return {Point} An Point where Point.x contains the velocity x value and Point.y contains the velocity y value
288304
*/
289305
public velocityFromFacing(parent: Sprite, speed: number): Point {
306+
307+
/*
290308
var a: number;
291309
292310
if (parent.body.facing == Types.LEFT)
@@ -307,6 +325,9 @@ module Phaser {
307325
}
308326
309327
return new Point(Math.cos(a) * speed, Math.sin(a) * speed);
328+
*/
329+
330+
return new Point;
310331

311332
}
312333

Phaser/Phaser.csproj

Lines changed: 34 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@
5656
<TypeScriptOutFile>../build/phaser.js</TypeScriptOutFile>
5757
<TypeScriptGeneratesDeclarations>true</TypeScriptGeneratesDeclarations>
5858
</PropertyGroup>
59-
<ItemGroup>
60-
<Folder Include="physics\arcade\" />
61-
</ItemGroup>
59+
<ItemGroup />
6260
<ItemGroup>
6361
<Content Include="components\animation\AnimationManager.js">
6462
<DependentUpon>AnimationManager.ts</DependentUpon>
@@ -143,7 +141,6 @@
143141
<TypeScriptCompile Include="renderers\CanvasRenderer.ts" />
144142
<TypeScriptCompile Include="Statics.ts" />
145143
<TypeScriptCompile Include="renderers\HeadlessRenderer.ts" />
146-
<TypeScriptCompile Include="physics\PhysicsManager.ts" />
147144
<TypeScriptCompile Include="physics\Body.ts" />
148145
<TypeScriptCompile Include="math\QuadTree.ts" />
149146
<TypeScriptCompile Include="math\Mat3.ts" />
@@ -177,84 +174,73 @@
177174
<Content Include="Motion.js">
178175
<DependentUpon>Motion.ts</DependentUpon>
179176
</Content>
180-
<TypeScriptCompile Include="physics\ArcadePhysics.ts" />
181-
<TypeScriptCompile Include="physics\advanced\Body.ts" />
182-
<Content Include="physics\advanced\Body.js">
177+
<Content Include="physics\Body.js">
183178
<DependentUpon>Body.ts</DependentUpon>
184179
</Content>
185-
<TypeScriptCompile Include="physics\advanced\Bounds.ts" />
186-
<Content Include="physics\advanced\Bounds.js">
180+
<TypeScriptCompile Include="physics\Bounds.ts" />
181+
<Content Include="physics\Bounds.js">
187182
<DependentUpon>Bounds.ts</DependentUpon>
188183
</Content>
189-
<TypeScriptCompile Include="physics\advanced\Contact.ts" />
190-
<TypeScriptCompile Include="physics\advanced\Collision.ts" />
191-
<Content Include="physics\advanced\Collision.js">
184+
<TypeScriptCompile Include="physics\Collision.ts" />
185+
<Content Include="physics\Collision.js">
192186
<DependentUpon>Collision.ts</DependentUpon>
193187
</Content>
194-
<Content Include="physics\advanced\Contact.js">
188+
<TypeScriptCompile Include="physics\Contact.ts" />
189+
<Content Include="physics\Contact.js">
195190
<DependentUpon>Contact.ts</DependentUpon>
196191
</Content>
197-
<TypeScriptCompile Include="physics\advanced\ContactSolver.ts" />
198-
<Content Include="physics\advanced\ContactSolver.js">
192+
<TypeScriptCompile Include="physics\ContactSolver.ts" />
193+
<Content Include="physics\ContactSolver.js">
199194
<DependentUpon>ContactSolver.ts</DependentUpon>
200195
</Content>
201-
<TypeScriptCompile Include="physics\advanced\Manager.ts" />
202-
<TypeScriptCompile Include="physics\advanced\joints\IJoint.ts" />
203-
<Content Include="physics\advanced\joints\IJoint.js">
196+
<TypeScriptCompile Include="physics\Manager.ts" />
197+
<TypeScriptCompile Include="physics\joints\IJoint.ts" />
198+
<Content Include="physics\joints\IJoint.js">
204199
<DependentUpon>IJoint.ts</DependentUpon>
205200
</Content>
206-
<TypeScriptCompile Include="physics\advanced\joints\Joint.ts" />
207-
<Content Include="physics\advanced\joints\Joint.js">
201+
<TypeScriptCompile Include="physics\joints\Joint.ts" />
202+
<Content Include="physics\joints\Joint.js">
208203
<DependentUpon>Joint.ts</DependentUpon>
209204
</Content>
210-
<Content Include="physics\advanced\Manager.js">
205+
<Content Include="physics\Manager.js">
211206
<DependentUpon>Manager.ts</DependentUpon>
212207
</Content>
213-
<TypeScriptCompile Include="physics\advanced\shapes\Shape.ts" />
214-
<TypeScriptCompile Include="physics\advanced\shapes\IShape.ts" />
215-
<TypeScriptCompile Include="physics\advanced\shapes\Box.ts" />
216-
<TypeScriptCompile Include="physics\advanced\Plane.ts" />
217-
<Content Include="physics\advanced\Plane.js">
208+
<TypeScriptCompile Include="physics\Plane.ts" />
209+
<Content Include="physics\Plane.js">
218210
<DependentUpon>Plane.ts</DependentUpon>
219211
</Content>
220-
<Content Include="physics\advanced\shapes\Box.js">
212+
<TypeScriptCompile Include="physics\Space.ts" />
213+
<TypeScriptCompile Include="physics\shapes\Box.ts" />
214+
<Content Include="physics\shapes\Box.js">
221215
<DependentUpon>Box.ts</DependentUpon>
222216
</Content>
223-
<TypeScriptCompile Include="physics\advanced\shapes\Circle.ts" />
224-
<Content Include="physics\advanced\shapes\Circle.js">
217+
<TypeScriptCompile Include="physics\shapes\Circle.ts" />
218+
<Content Include="physics\shapes\Circle.js">
225219
<DependentUpon>Circle.ts</DependentUpon>
226220
</Content>
227-
<Content Include="physics\advanced\shapes\IShape.js">
221+
<TypeScriptCompile Include="physics\shapes\IShape.ts" />
222+
<Content Include="physics\shapes\IShape.js">
228223
<DependentUpon>IShape.ts</DependentUpon>
229224
</Content>
230-
<TypeScriptCompile Include="physics\advanced\shapes\Poly.ts" />
231-
<Content Include="physics\advanced\shapes\Poly.js">
225+
<TypeScriptCompile Include="physics\shapes\Poly.ts" />
226+
<Content Include="physics\shapes\Poly.js">
232227
<DependentUpon>Poly.ts</DependentUpon>
233228
</Content>
234-
<TypeScriptCompile Include="physics\advanced\shapes\Segment.ts" />
235-
<Content Include="physics\advanced\shapes\Segment.js">
229+
<TypeScriptCompile Include="physics\shapes\Segment.ts" />
230+
<Content Include="physics\shapes\Segment.js">
236231
<DependentUpon>Segment.ts</DependentUpon>
237232
</Content>
238-
<Content Include="physics\advanced\shapes\Shape.js">
233+
<TypeScriptCompile Include="physics\shapes\Shape.ts" />
234+
<Content Include="physics\shapes\Shape.js">
239235
<DependentUpon>Shape.ts</DependentUpon>
240236
</Content>
241-
<TypeScriptCompile Include="physics\advanced\shapes\Triangle.ts" />
242-
<Content Include="physics\advanced\shapes\Triangle.js">
237+
<TypeScriptCompile Include="physics\shapes\Triangle.ts" />
238+
<Content Include="physics\shapes\Triangle.js">
243239
<DependentUpon>Triangle.ts</DependentUpon>
244240
</Content>
245-
<TypeScriptCompile Include="physics\advanced\Space.ts" />
246-
<Content Include="physics\advanced\Space.js">
241+
<Content Include="physics\Space.js">
247242
<DependentUpon>Space.ts</DependentUpon>
248243
</Content>
249-
<Content Include="physics\ArcadePhysics.js">
250-
<DependentUpon>ArcadePhysics.ts</DependentUpon>
251-
</Content>
252-
<Content Include="physics\Body.js">
253-
<DependentUpon>Body.ts</DependentUpon>
254-
</Content>
255-
<Content Include="physics\PhysicsManager.js">
256-
<DependentUpon>PhysicsManager.ts</DependentUpon>
257-
</Content>
258244
<Content Include="renderers\HeadlessRenderer.js">
259245
<DependentUpon>HeadlessRenderer.ts</DependentUpon>
260246
</Content>

0 commit comments

Comments
 (0)