| OLD | NEW |
| 1 part of sprites; | 1 part of sprites; |
| 2 | 2 |
| 3 /// Options for setting up a [SpriteBox]. | 3 /// Options for setting up a [SpriteBox]. |
| 4 /// | 4 /// |
| 5 /// * [nativePoints], use the same points as the parent [Widget]. | 5 /// * [nativePoints], use the same points as the parent [Widget]. |
| 6 /// * [letterbox], use the size of the root node for the coordinate system, con
strain the aspect ratio and trim off | 6 /// * [letterbox], use the size of the root node for the coordinate system, con
strain the aspect ratio and trim off |
| 7 /// areas that end up outside the screen. | 7 /// areas that end up outside the screen. |
| 8 /// * [stretch], use the size of the root node for the coordinate system, scale
it to fit the size of the box. | 8 /// * [stretch], use the size of the root node for the coordinate system, scale
it to fit the size of the box. |
| 9 /// * [scaleToFit], similar to the letterbox option, but instead of trimming ar
eas the sprite system will be scaled | 9 /// * [scaleToFit], similar to the letterbox option, but instead of trimming ar
eas the sprite system will be scaled |
| 10 /// down to fit the box. | 10 /// down to fit the box. |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 | 286 |
| 287 // Print frame rate | 287 // Print frame rate |
| 288 if (_numFrames % 60 == 0) print("delta: $delta fps: $_frameRate"); | 288 if (_numFrames % 60 == 0) print("delta: $delta fps: $_frameRate"); |
| 289 | 289 |
| 290 _callUpdate(_rootNode, delta); | 290 _callUpdate(_rootNode, delta); |
| 291 _scheduleTick(); | 291 _scheduleTick(); |
| 292 } | 292 } |
| 293 | 293 |
| 294 void _callUpdate(Node node, double dt) { | 294 void _callUpdate(Node node, double dt) { |
| 295 node.update(dt); | 295 node.update(dt); |
| 296 for (Node child in node.children) { | 296 for (int i = node.children.length - 1; i >= 0; i--) { |
| 297 Node child = node.children[i]; |
| 297 if (!child.paused) { | 298 if (!child.paused) { |
| 298 _callUpdate(child, dt); | 299 _callUpdate(child, dt); |
| 299 } | 300 } |
| 300 } | 301 } |
| 301 } | 302 } |
| 302 | 303 |
| 303 void _callSpriteBoxPerformedLayout(Node node) { | 304 void _callSpriteBoxPerformedLayout(Node node) { |
| 304 node.spriteBoxPerformedLayout(); | 305 node.spriteBoxPerformedLayout(); |
| 305 for (Node child in node.children) { | 306 for (Node child in node.children) { |
| 306 _callSpriteBoxPerformedLayout(child); | 307 _callSpriteBoxPerformedLayout(child); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 /// if (event.pointer == firstPointerId) { | 374 /// if (event.pointer == firstPointerId) { |
| 374 /// // Do something | 375 /// // Do something |
| 375 /// } | 376 /// } |
| 376 final int pointer; | 377 final int pointer; |
| 377 | 378 |
| 378 /// Creates a new SpriteBoxEvent, typically this is done internally inside the
SpriteBox. | 379 /// Creates a new SpriteBoxEvent, typically this is done internally inside the
SpriteBox. |
| 379 /// | 380 /// |
| 380 /// var event = new SpriteBoxEvent(new Point(50.0, 50.0), 'pointerdown', 0
); | 381 /// var event = new SpriteBoxEvent(new Point(50.0, 50.0), 'pointerdown', 0
); |
| 381 SpriteBoxEvent(this.boxPosition, this.type, this.pointer); | 382 SpriteBoxEvent(this.boxPosition, this.type, this.pointer); |
| 382 } | 383 } |
| OLD | NEW |