Skip to content

Commit 533a4c2

Browse files
committed
Commiting before a small refactor of Shapes and Joints
1 parent dd8962d commit 533a4c2

22 files changed

Lines changed: 1499 additions & 129 deletions

Phaser/Phaser.csproj

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@
182182
<Content Include="physics\advanced\Body.js">
183183
<DependentUpon>Body.ts</DependentUpon>
184184
</Content>
185-
<TypeScriptCompile Include="physics\advanced\Joint.ts" />
186185
<TypeScriptCompile Include="physics\advanced\Bounds.ts" />
187186
<Content Include="physics\advanced\Bounds.js">
188187
<DependentUpon>Bounds.ts</DependentUpon>
@@ -199,25 +198,18 @@
199198
<Content Include="physics\advanced\ContactSolver.js">
200199
<DependentUpon>ContactSolver.ts</DependentUpon>
201200
</Content>
202-
<TypeScriptCompile Include="physics\advanced\IShape.ts" />
203-
<Content Include="physics\advanced\IShape.js">
204-
<DependentUpon>IShape.ts</DependentUpon>
205-
</Content>
206-
<Content Include="physics\advanced\Joint.js">
207-
<DependentUpon>Joint.ts</DependentUpon>
208-
</Content>
209201
<TypeScriptCompile Include="physics\advanced\Manager.ts" />
210202
<TypeScriptCompile Include="physics\advanced\joints\IJoint.ts" />
211203
<Content Include="physics\advanced\joints\IJoint.js">
212204
<DependentUpon>IJoint.ts</DependentUpon>
213205
</Content>
206+
<TypeScriptCompile Include="physics\advanced\joints\Joint.ts" />
207+
<Content Include="physics\advanced\joints\Joint.js">
208+
<DependentUpon>Joint.ts</DependentUpon>
209+
</Content>
214210
<Content Include="physics\advanced\Manager.js">
215211
<DependentUpon>Manager.ts</DependentUpon>
216212
</Content>
217-
<TypeScriptCompile Include="physics\advanced\Shape.ts" />
218-
<Content Include="physics\advanced\Shape.js">
219-
<DependentUpon>Shape.ts</DependentUpon>
220-
</Content>
221213
<TypeScriptCompile Include="physics\advanced\ShapeCircle.ts" />
222214
<TypeScriptCompile Include="physics\advanced\ShapeBox.ts" />
223215
<Content Include="physics\advanced\ShapeBox.js">
@@ -235,6 +227,14 @@
235227
<DependentUpon>ShapeSegment.ts</DependentUpon>
236228
</Content>
237229
<TypeScriptCompile Include="physics\advanced\ShapeTriangle.ts" />
230+
<TypeScriptCompile Include="physics\advanced\shapes\Shape.ts" />
231+
<TypeScriptCompile Include="physics\advanced\shapes\IShape.ts" />
232+
<Content Include="physics\advanced\shapes\IShape.js">
233+
<DependentUpon>IShape.ts</DependentUpon>
234+
</Content>
235+
<Content Include="physics\advanced\shapes\Shape.js">
236+
<DependentUpon>Shape.ts</DependentUpon>
237+
</Content>
238238
<Content Include="physics\advanced\ShapeTriangle.js">
239239
<DependentUpon>ShapeTriangle.ts</DependentUpon>
240240
</Content>

Phaser/physics/advanced/Body.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
/// <reference path="../../math/Transform.ts" />
55
/// <reference path="../../math/TransformUtils.ts" />
66
/// <reference path="Manager.ts" />
7-
/// <reference path="Joint.ts" />
7+
/// <reference path="joints/Joint.ts" />
88
/// <reference path="Bounds.ts" />
99
/// <reference path="Space.ts" />
10-
/// <reference path="IShape.ts" />
10+
/// <reference path="shapes/IShape.ts" />
1111

1212
/**
1313
* Phaser - Advanced Physics - Body
@@ -147,7 +147,7 @@ module Phaser.Physics.Advanced {
147147

148148
public duplicate() {
149149

150-
console.log('body duplicate called');
150+
//console.log('body duplicate called');
151151

152152
//var body = new Body(this.type, this.transform.t, this.angle);
153153

@@ -314,7 +314,7 @@ module Phaser.Physics.Advanced {
314314
var mass = shape.area() * shape.density;
315315
var inertia = shape.inertia(mass);
316316

317-
console.log('rmd', centroid, shape);
317+
//console.log('rmd', centroid, shape);
318318

319319
totalMassCentroid.multiplyAddByScalar(centroid, mass);
320320
totalMass += mass;
@@ -368,7 +368,7 @@ module Phaser.Physics.Advanced {
368368

369369
public cacheData() {
370370

371-
console.log('Body cacheData', this.name, 'len', this.shapes.length);
371+
//console.log('Body cacheData', this.name, 'len', this.shapes.length);
372372

373373
this.bounds.clear();
374374

@@ -501,7 +501,7 @@ module Phaser.Physics.Advanced {
501501

502502
}
503503

504-
public applyAngularImpulse(impulse) {
504+
public applyAngularImpulse(impulse: number) {
505505

506506
if (this.isDynamic == false)
507507
{

Phaser/physics/advanced/Bounds.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,6 @@ module Phaser.Physics.Advanced {
157157
return false;
158158
}
159159

160-
console.log('intersects TRUE');
161-
console.log(this);
162-
console.log(b);
163-
164160
return true;
165161
}
166162

Phaser/physics/advanced/Collision.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/// <reference path="../../math/Vec2Utils.ts" />
44
/// <reference path="Manager.ts" />
55
/// <reference path="Body.ts" />
6-
/// <reference path="Shape.ts" />
6+
/// <reference path="shapes/Shape.ts" />
77
/// <reference path="Contact.ts" />
88
/// <reference path="ShapeCircle.ts" />
99

@@ -22,7 +22,7 @@ module Phaser.Physics.Advanced {
2222

2323
public collide(a, b, contacts: Contact[]) {
2424

25-
console.log('collide', a.type, b.type);
25+
//console.log('collide', a.type, b.type);
2626

2727
// Circle (a is the circle)
2828
if (a.type == Manager.SHAPE_TYPE_CIRCLE)

Phaser/physics/advanced/Contact.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/// <reference path="../../math/Vec2Utils.ts" />
44
/// <reference path="Manager.ts" />
55
/// <reference path="Body.ts" />
6-
/// <reference path="Shape.ts" />
6+
/// <reference path="shapes/Shape.ts" />
77

88
/**
99
* Phaser - Advanced Physics - Contact

Phaser/physics/advanced/ContactSolver.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/// <reference path="../../math/Vec2Utils.ts" />
44
/// <reference path="Manager.ts" />
55
/// <reference path="Body.ts" />
6-
/// <reference path="Shape.ts" />
6+
/// <reference path="shapes/Shape.ts" />
77
/// <reference path="Contact.ts" />
88

99
/**
@@ -38,7 +38,7 @@ module Phaser.Physics.Advanced {
3838

3939
constructor(shape1, shape2) {
4040

41-
console.log('ContactSolver super');
41+
//console.log('ContactSolver super');
4242

4343
this.shape1 = shape1;
4444
this.shape2 = shape2;
@@ -99,8 +99,8 @@ module Phaser.Physics.Advanced {
9999
{
100100
var con: Contact = this.contacts[i];
101101

102-
console.log('initSolver con');
103-
console.log(con);
102+
//console.log('initSolver con');
103+
//console.log(con);
104104

105105
// Transformed r1, r2
106106
Phaser.Vec2Utils.subtract(con.point, body1.position, con.r1);
@@ -149,10 +149,6 @@ module Phaser.Physics.Advanced {
149149

150150
// bounce velocity dot n
151151
con.bounce = Phaser.Vec2Utils.dot(rv, con.normal) * this.elasticity;
152-
console.log('bounce?', Phaser.Vec2Utils.dot(rv, con.normal), this.elasticity);
153-
154-
console.log('con over');
155-
console.log(con);
156152

157153
}
158154
}

Phaser/physics/advanced/Manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/// <reference path="../../Game.ts" />
22
/// <reference path="Body.ts" />
3-
/// <reference path="Joint.ts" />
3+
/// <reference path="joints/Joint.ts" />
44

55
/**
66
* Phaser - Advanced Physics Manager

Phaser/physics/advanced/ShapePoly.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ module Phaser.Physics.Advanced {
3131
{
3232
for (var i = 0; i < verts.length; i++)
3333
{
34-
console.log('cloning vert', i);
34+
//console.log('cloning vert', i);
3535
this.verts[i] = Phaser.Vec2Utils.clone(verts[i]);
3636
this.tverts[i] = this.verts[i];
3737

@@ -41,11 +41,11 @@ module Phaser.Physics.Advanced {
4141
}
4242
}
4343

44-
console.log('ShapePoly finished', this.verts);
44+
//console.log('ShapePoly finished', this.verts);
4545

4646
this.finishVerts();
4747

48-
console.log('ShapePoly finished 2', this.verts);
48+
//console.log('ShapePoly finished 2', this.verts);
4949

5050
}
5151

@@ -146,7 +146,7 @@ module Phaser.Physics.Advanced {
146146

147147
var numVerts = this.verts.length;
148148

149-
console.log('shapePoly cacheData', numVerts);
149+
//console.log('shapePoly cacheData', numVerts);
150150

151151
if (numVerts == 0)
152152
{

Phaser/physics/advanced/Space.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/// <reference path="../../math/Vec2Utils.ts" />
44
/// <reference path="Manager.ts" />
55
/// <reference path="Body.ts" />
6-
/// <reference path="Shape.ts" />
6+
/// <reference path="shapes/Shape.ts" />
77
/// <reference path="ContactSolver.ts" />
88
/// <reference path="Contact.ts" />
99
/// <reference path="Collision.ts" />
@@ -85,7 +85,7 @@ module Phaser.Physics.Advanced {
8585
return;
8686
}
8787

88-
console.log('Body added to space', body.name);
88+
//console.log('Body added to space', body.name);
8989

9090
var index = this.bodyArr.push(body) - 1;
9191
this.bodyHash[body.id] = index;
@@ -449,7 +449,7 @@ module Phaser.Physics.Advanced {
449449

450450
public genTemporalContactSolvers() {
451451

452-
console.log('genTemporalContactSolvers');
452+
//console.log('genTemporalContactSolvers');
453453

454454
//var t0 = Date.now();
455455

@@ -510,7 +510,7 @@ module Phaser.Physics.Advanced {
510510
continue;
511511
}
512512

513-
console.log('>>>>>>>>>> intersects');
513+
//console.log('>>>>>>>>>> intersects');
514514

515515
for (var i = 0; i < body1.shapes.length; i++)
516516
{
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
/// <reference path="../../math/Vec2.ts" />
2-
/// <reference path="../../geom/Point.ts" />
3-
/// <reference path="../../math/Vec2Utils.ts" />
4-
/// <reference path="Manager.ts" />
5-
/// <reference path="Body.ts" />
1+
/// <reference path="../../../math/Vec2.ts" />
2+
/// <reference path="../../../geom/Point.ts" />
3+
/// <reference path="../../../math/Vec2Utils.ts" />
4+
/// <reference path="../Manager.ts" />
5+
/// <reference path="../Body.ts" />
66

77
/**
88
* Phaser - Advanced Physics - Joint

0 commit comments

Comments
 (0)