Chromium Code Reviews| 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 280 _lastTimeStamp = timeStamp; | 280 _lastTimeStamp = timeStamp; |
| 281 | 281 |
| 282 // Count the number of frames we've been running | 282 // Count the number of frames we've been running |
| 283 _numFrames += 1; | 283 _numFrames += 1; |
| 284 | 284 |
| 285 _frameRate = 1.0/delta; | 285 _frameRate = 1.0/delta; |
| 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 _runActions(_rootNode, delta); | |
| 290 _callUpdate(_rootNode, delta); | 291 _callUpdate(_rootNode, delta); |
| 291 _scheduleTick(); | 292 _scheduleTick(); |
| 292 } | 293 } |
| 293 | 294 |
| 295 void _runActions(Node node, double dt) { | |
| 296 if (node._actions != null) { | |
| 297 node._actions.step(dt); | |
| 298 } | |
| 299 for (int i = node.children.length - 1; i >= 0; i--) { | |
|
kulakowski
2015/07/01 22:18:43
FYI List has a |reversed| property:
for (final No
| |
| 300 Node child = node.children[i]; | |
| 301 _runActions(child, dt); | |
| 302 } | |
| 303 } | |
| 304 | |
| 294 void _callUpdate(Node node, double dt) { | 305 void _callUpdate(Node node, double dt) { |
| 295 node.update(dt); | 306 node.update(dt); |
| 296 for (int i = node.children.length - 1; i >= 0; i--) { | 307 for (int i = node.children.length - 1; i >= 0; i--) { |
| 297 Node child = node.children[i]; | 308 Node child = node.children[i]; |
| 298 if (!child.paused) { | 309 if (!child.paused) { |
| 299 _callUpdate(child, dt); | 310 _callUpdate(child, dt); |
| 300 } | 311 } |
| 301 } | 312 } |
| 302 } | 313 } |
| 303 | 314 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 374 /// if (event.pointer == firstPointerId) { | 385 /// if (event.pointer == firstPointerId) { |
| 375 /// // Do something | 386 /// // Do something |
| 376 /// } | 387 /// } |
| 377 final int pointer; | 388 final int pointer; |
| 378 | 389 |
| 379 /// Creates a new SpriteBoxEvent, typically this is done internally inside the SpriteBox. | 390 /// Creates a new SpriteBoxEvent, typically this is done internally inside the SpriteBox. |
| 380 /// | 391 /// |
| 381 /// var event = new SpriteBoxEvent(new Point(50.0, 50.0), 'pointerdown', 0 ); | 392 /// var event = new SpriteBoxEvent(new Point(50.0, 50.0), 'pointerdown', 0 ); |
| 382 SpriteBoxEvent(this.boxPosition, this.type, this.pointer); | 393 SpriteBoxEvent(this.boxPosition, this.type, this.pointer); |
| 383 } | 394 } |
| OLD | NEW |