Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #2 from dominichamon/master

Disabled debug drawing for Dart version
  • Loading branch information...
commit 3a76bbfaf9a80d47c1cbeb7bb88a7de5d213b0f2 2 parents 990a0d1 + e82ec61
@joelgwebber authored
Showing with 1,472 additions and 1,008 deletions.
  1. +13 −7 dart/Bench2d.dart
  2. +1,459 −1,001 dart/Bench2d.dart.js
View
20 dart/Bench2d.dart
@@ -39,7 +39,9 @@ class Bench2d {
World world;
- Bench2d() {
+ bool _doDebugDraw;
+
+ Bench2d([_doDebugDraw = false]) {
final gravity = new Vector(0, GRAVITY);
bool doSleep = true;
world = new World(gravity, doSleep, new DefaultWorldPool());
@@ -62,11 +64,13 @@ class Bench2d {
viewport = new CanvasViewportTransform(extents, extents);
viewport.scale = _VIEWPORT_SCALE;
- // Create our canvas drawing tool to give to the world.
- debugDraw = new CanvasDraw(viewport, ctx);
+ if (_doDebugDraw) {
+ // Create our canvas drawing tool to give to the world.
+ debugDraw = new CanvasDraw(viewport, ctx);
- // Have the world draw itself for debugging purposes.
- world.debugDraw = debugDraw;
+ // Have the world draw itself for debugging purposes.
+ world.debugDraw = debugDraw;
+ }
}
void initialize() {
@@ -122,8 +126,10 @@ class Bench2d {
void render() {
step();
- ctx.clearRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT);
- world.drawDebugData();
+ if (_doDebugDraw) {
+ ctx.clearRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT);
+ world.drawDebugData();
+ }
window.webkitRequestAnimationFrame((num time) {
render();
}, canvas);
View
2,460 dart/Bench2d.dart.js
1,459 additions, 1,001 deletions not shown
Please sign in to comment.
Something went wrong with that request. Please try again.