Skip to content

Commit d848fa0

Browse files
committed
Merge branch 'photonstorm/097'
2 parents 1bcbf91 + 7dac2b6 commit d848fa0

153 files changed

Lines changed: 20893 additions & 16095 deletions

File tree

Some content is hidden

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

Phaser/Game.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
/// <reference path="core/Rectangle.ts" />
1+
/// <reference path="geom/Rectangle.ts" />
22
/// <reference path="math/LinkedList.ts" />
33
/// <reference path="math/QuadTree.ts" />
4-
/// <reference path="core/Point.ts" />
5-
/// <reference path="core/Vec2.ts" />
6-
/// <reference path="core/Circle.ts" />
4+
/// <reference path="geom/Point.ts" />
5+
/// <reference path="math/Vec2.ts" />
6+
/// <reference path="geom/Circle.ts" />
77
/// <reference path="core/Group.ts" />
88
/// <reference path="core/Signal.ts" />
99
/// <reference path="core/SignalBinding.ts" />
@@ -416,6 +416,8 @@ module Phaser {
416416
this.onUpdateCallback.call(this.callbackContext);
417417
}
418418

419+
this.world.postUpdate();
420+
419421
this.renderer.render();
420422

421423
if (this._loadComplete && this.onRenderCallback)

Phaser/Motion.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,8 @@ module Phaser {
210210
* @return {number} Distance (in pixels)
211211
*/
212212
public distanceToPoint(a: Sprite, target: Point): number {
213-
var dx: number = (a.x + a.origin.x) - (target.x);
214-
var dy: number = (a.y + a.origin.y) - (target.y);
213+
var dx: number = (a.x + a.transform.origin.x) - (target.x);
214+
var dy: number = (a.y + a.transform.origin.y) - (target.y);
215215

216216
return this.game.math.vectorLength(dx, dy);
217217
}
@@ -223,8 +223,8 @@ module Phaser {
223223
* @return {number} The distance between the given sprite and the mouse coordinates
224224
*/
225225
public distanceToMouse(a: Sprite): number {
226-
var dx: number = (a.x + a.origin.x) - this.game.input.x;
227-
var dy: number = (a.y + a.origin.y) - this.game.input.y;
226+
var dx: number = (a.x + a.transform.origin.x) - this.game.input.x;
227+
var dy: number = (a.y + a.transform.origin.y) - this.game.input.y;
228228

229229
return this.game.math.vectorLength(dx, dy);
230230
}
@@ -240,8 +240,8 @@ module Phaser {
240240
* @return {number} The angle (in radians unless asDegrees is true)
241241
*/
242242
public angleBetweenPoint(a: Sprite, target: Point, asDegrees: bool = false): number {
243-
var dx: number = (target.x) - (a.x + a.origin.x);
244-
var dy: number = (target.y) - (a.y + a.origin.y);
243+
var dx: number = (target.x) - (a.x + a.transform.origin.x);
244+
var dy: number = (target.y) - (a.y + a.transform.origin.y);
245245

246246
if (asDegrees)
247247
{
@@ -265,8 +265,8 @@ module Phaser {
265265
*/
266266
public angleBetween(a: Sprite, b: Sprite, asDegrees: bool = false): number {
267267

268-
var dx: number = (b.x + b.origin.x) - (a.x + a.origin.x);
269-
var dy: number = (b.y + b.origin.y) - (a.y + a.origin.y);
268+
var dx: number = (b.x + b.transform.origin.x) - (a.x + a.transform.origin.x);
269+
var dy: number = (b.y + b.transform.origin.y) - (a.y + a.transform.origin.y);
270270

271271
if (asDegrees)
272272
{

Phaser/Phaser.csproj

Lines changed: 36 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -74,36 +74,24 @@
7474
<Content Include="components\sprite\Input.js">
7575
<DependentUpon>Input.ts</DependentUpon>
7676
</Content>
77+
<TypeScriptCompile Include="components\Texture.ts" />
78+
<Content Include="components\Texture.js">
79+
<DependentUpon>Texture.ts</DependentUpon>
80+
</Content>
7781
<Content Include="components\Tile.ts" />
7882
<Content Include="components\TilemapLayer.ts" />
83+
<TypeScriptCompile Include="components\Transform.ts" />
84+
<Content Include="components\Transform.js">
85+
<DependentUpon>Transform.ts</DependentUpon>
86+
</Content>
7987
<Content Include="Game.js">
8088
<DependentUpon>Game.ts</DependentUpon>
8189
</Content>
82-
<TypeScriptCompile Include="core\Rectangle.ts" />
83-
<TypeScriptCompile Include="core\Point.ts" />
84-
<TypeScriptCompile Include="components\sprite\Texture.ts" />
8590
<TypeScriptCompile Include="components\camera\CameraFX.ts" />
8691
<Content Include="components\camera\CameraFX.js">
8792
<DependentUpon>CameraFX.ts</DependentUpon>
8893
</Content>
8994
<TypeScriptCompile Include="components\ScrollRegion.ts" />
90-
<Content Include="components\sprite\Texture.js">
91-
<DependentUpon>Texture.ts</DependentUpon>
92-
</Content>
93-
<Content Include="core\Point.js">
94-
<DependentUpon>Point.ts</DependentUpon>
95-
</Content>
96-
<TypeScriptCompile Include="core\Polygon.ts" />
97-
<Content Include="core\Polygon.js">
98-
<DependentUpon>Polygon.ts</DependentUpon>
99-
</Content>
100-
<Content Include="core\Rectangle.js">
101-
<DependentUpon>Rectangle.ts</DependentUpon>
102-
</Content>
103-
<TypeScriptCompile Include="core\Vec2.ts" />
104-
<Content Include="core\Vec2.js">
105-
<DependentUpon>Vec2.ts</DependentUpon>
106-
</Content>
10795
<Content Include="gameobjects\DynamicTexture.js">
10896
<DependentUpon>DynamicTexture.ts</DependentUpon>
10997
</Content>
@@ -122,6 +110,22 @@
122110
<Content Include="gameobjects\Tilemap.js">
123111
<DependentUpon>Tilemap.ts</DependentUpon>
124112
</Content>
113+
<TypeScriptCompile Include="geom\Circle.ts" />
114+
<Content Include="geom\Circle.js">
115+
<DependentUpon>Circle.ts</DependentUpon>
116+
</Content>
117+
<TypeScriptCompile Include="geom\Line.ts" />
118+
<Content Include="geom\Line.js">
119+
<DependentUpon>Line.ts</DependentUpon>
120+
</Content>
121+
<TypeScriptCompile Include="geom\Point.ts" />
122+
<Content Include="geom\Point.js">
123+
<DependentUpon>Point.ts</DependentUpon>
124+
</Content>
125+
<TypeScriptCompile Include="geom\Rectangle.ts" />
126+
<Content Include="geom\Rectangle.js">
127+
<DependentUpon>Rectangle.ts</DependentUpon>
128+
</Content>
125129
<Content Include="math\GameMath.js">
126130
<DependentUpon>GameMath.ts</DependentUpon>
127131
</Content>
@@ -140,6 +144,14 @@
140144
<TypeScriptCompile Include="physics\PhysicsManager.ts" />
141145
<TypeScriptCompile Include="physics\Body.ts" />
142146
<TypeScriptCompile Include="math\QuadTree.ts" />
147+
<TypeScriptCompile Include="math\Mat3.ts" />
148+
<Content Include="math\Mat3.js">
149+
<DependentUpon>Mat3.ts</DependentUpon>
150+
</Content>
151+
<TypeScriptCompile Include="math\Mat3Utils.ts" />
152+
<Content Include="math\Mat3Utils.js">
153+
<DependentUpon>Mat3Utils.ts</DependentUpon>
154+
</Content>
143155
<Content Include="math\QuadTree.js">
144156
<DependentUpon>QuadTree.ts</DependentUpon>
145157
</Content>
@@ -148,6 +160,10 @@
148160
<DependentUpon>LinkedList.ts</DependentUpon>
149161
</Content>
150162
<TypeScriptCompile Include="Motion.ts" />
163+
<TypeScriptCompile Include="math\Vec2.ts" />
164+
<Content Include="math\Vec2.js">
165+
<DependentUpon>Vec2.ts</DependentUpon>
166+
</Content>
151167
<Content Include="Motion.js">
152168
<DependentUpon>Motion.ts</DependentUpon>
153169
</Content>
@@ -196,15 +212,9 @@
196212
<Content Include="utils\RectangleUtils.js">
197213
<DependentUpon>RectangleUtils.ts</DependentUpon>
198214
</Content>
199-
<Content Include="core\Circle.js">
200-
<DependentUpon>Circle.ts</DependentUpon>
201-
</Content>
202215
<Content Include="math\IntersectResult.js">
203216
<DependentUpon>IntersectResult.ts</DependentUpon>
204217
</Content>
205-
<Content Include="core\Line.js">
206-
<DependentUpon>Line.ts</DependentUpon>
207-
</Content>
208218
<TypeScriptCompile Include="math\Vec2Utils.ts" />
209219
<Content Include="math\Vec2Utils.js">
210220
<DependentUpon>Vec2Utils.ts</DependentUpon>
@@ -337,9 +347,7 @@
337347
<TypeScriptCompile Include="components\animation\Frame.ts" />
338348
<TypeScriptCompile Include="loader\AnimationLoader.ts" />
339349
<TypeScriptCompile Include="components\animation\Animation.ts" />
340-
<TypeScriptCompile Include="core\Line.ts" />
341350
<TypeScriptCompile Include="math\IntersectResult.ts" />
342-
<TypeScriptCompile Include="core\Circle.ts" />
343351
<Content Include="core\Group.js">
344352
<DependentUpon>Group.ts</DependentUpon>
345353
</Content>

Phaser/Stage.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ module Phaser {
5353
this.context = this.canvas.getContext('2d');
5454

5555
this.scaleMode = StageScaleMode.NO_SCALE;
56-
this.scale = new StageScaleMode(this._game);
56+
this.scale = new StageScaleMode(this._game, width, height);
5757

5858
this.getOffset(this.canvas);
5959
this.bounds = new Rectangle(this.offset.x, this.offset.y, width, height);
@@ -167,6 +167,8 @@ module Phaser {
167167
this.pauseScreen = new PauseScreen(this._game, this.width, this.height);
168168
this.orientationScreen = new OrientationScreen(this._game);
169169

170+
this.scale.setScreenSize(true);
171+
170172
}
171173

172174
/**
@@ -253,6 +255,13 @@ module Phaser {
253255

254256
}
255257

258+
public setImageRenderingCrisp() {
259+
this.canvas.style['image-rendering'] = 'crisp-edges';
260+
this.canvas.style['image-rendering'] = '-moz-crisp-edges';
261+
this.canvas.style['image-rendering'] = '-webkit-optimize-contrast';
262+
this.canvas.style['-ms-interpolation-mode'] = 'nearest-neighbor';
263+
}
264+
256265
public pauseGame() {
257266

258267
if (this.disablePauseScreen == false && this.pauseScreen)

Phaser/Statics.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module Phaser {
2020

2121
static GEOM_POINT: number = 0;
2222
static GEOM_CIRCLE: number = 1;
23-
static GEOM_RECTANGLE: number = 2;
23+
static GEOM_Rectangle: number = 2;
2424
static GEOM_LINE: number = 3;
2525
static GEOM_POLYGON: number = 4;
2626

Phaser/World.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/// <reference path="Game.ts" />
22
/// <reference path="cameras/CameraManager.ts" />
33
/// <reference path="core/Group.ts" />
4-
/// <reference path="core/Rectangle.ts" />
4+
/// <reference path="geom/Rectangle.ts" />
55
/// <reference path="physics/PhysicsManager.ts" />
66

77
/**
@@ -96,6 +96,17 @@ module Phaser {
9696

9797
}
9898

99+
/**
100+
* This is called automatically every frame, and is where main logic happens.
101+
*/
102+
public postUpdate() {
103+
104+
//this.physics.postUpdate();
105+
this.group.postUpdate();
106+
this.cameras.postUpdate();
107+
108+
}
109+
99110
/**
100111
* Clean up memory.
101112
*/

0 commit comments

Comments
 (0)