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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
281 _numFrames += 1; | 281 _numFrames += 1; |
282 | 282 |
283 _frameRate = 1.0/delta; | 283 _frameRate = 1.0/delta; |
284 | 284 |
285 // Print frame rate | 285 // Print frame rate |
286 if (_numFrames % 60 == 0) print("delta: $delta fps: $_frameRate"); | 286 if (_numFrames % 60 == 0) print("delta: $delta fps: $_frameRate"); |
287 | 287 |
288 _runActions(_rootNode, delta); | 288 _runActions(_rootNode, delta); |
289 _callUpdate(_rootNode, delta); | 289 _callUpdate(_rootNode, delta); |
290 _scheduleTick(); | 290 _scheduleTick(); |
291 markNeedsPaint(); | |
abarth-chromium
2015/07/10 20:24:54
Should should already be in the tree
| |
291 } | 292 } |
292 | 293 |
293 void _runActions(Node node, double dt) { | 294 void _runActions(Node node, double dt) { |
294 if (node._actions != null) { | 295 if (node._actions != null) { |
295 node._actions.step(dt); | 296 node._actions.step(dt); |
296 } | 297 } |
297 for (int i = node.children.length - 1; i >= 0; i--) { | 298 for (int i = node.children.length - 1; i >= 0; i--) { |
298 Node child = node.children[i]; | 299 Node child = node.children[i]; |
299 _runActions(child, dt); | 300 _runActions(child, dt); |
300 } | 301 } |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
383 /// if (event.pointer == firstPointerId) { | 384 /// if (event.pointer == firstPointerId) { |
384 /// // Do something | 385 /// // Do something |
385 /// } | 386 /// } |
386 final int pointer; | 387 final int pointer; |
387 | 388 |
388 /// Creates a new SpriteBoxEvent, typically this is done internally inside the SpriteBox. | 389 /// Creates a new SpriteBoxEvent, typically this is done internally inside the SpriteBox. |
389 /// | 390 /// |
390 /// var event = new SpriteBoxEvent(new Point(50.0, 50.0), 'pointerdown', 0 ); | 391 /// var event = new SpriteBoxEvent(new Point(50.0, 50.0), 'pointerdown', 0 ); |
391 SpriteBoxEvent(this.boxPosition, this.type, this.pointer); | 392 SpriteBoxEvent(this.boxPosition, this.type, this.pointer); |
392 } | 393 } |
OLD | NEW |