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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 _transformMatrix.scale(scaleX, scaleY); | 244 _transformMatrix.scale(scaleX, scaleY); |
245 | 245 |
246 return _transformMatrix; | 246 return _transformMatrix; |
247 } | 247 } |
248 | 248 |
249 void _invalidateTransformMatrix() { | 249 void _invalidateTransformMatrix() { |
250 _transformMatrix = null; | 250 _transformMatrix = null; |
251 _rootNode._invalidateToBoxTransformMatrix(); | 251 _rootNode._invalidateToBoxTransformMatrix(); |
252 } | 252 } |
253 | 253 |
254 void paint(RenderCanvas canvas, Offset offset) { | 254 void paint(PaintingCanvas canvas, Offset offset) { |
255 canvas.save(); | 255 canvas.save(); |
256 | 256 |
257 // Move to correct coordinate space before drawing | 257 // Move to correct coordinate space before drawing |
258 canvas.translate(offset.dx, offset.dy); | 258 canvas.translate(offset.dx, offset.dy); |
259 canvas.concat(transformMatrix.storage); | 259 canvas.concat(transformMatrix.storage); |
260 | 260 |
261 // Draw the sprite tree | 261 // Draw the sprite tree |
262 _rootNode._visit(canvas); | 262 _rootNode._visit(canvas); |
263 | 263 |
264 canvas.restore(); | 264 canvas.restore(); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 /// if (event.pointer == firstPointerId) { | 373 /// if (event.pointer == firstPointerId) { |
374 /// // Do something | 374 /// // Do something |
375 /// } | 375 /// } |
376 final int pointer; | 376 final int pointer; |
377 | 377 |
378 /// Creates a new SpriteBoxEvent, typically this is done internally inside the
SpriteBox. | 378 /// Creates a new SpriteBoxEvent, typically this is done internally inside the
SpriteBox. |
379 /// | 379 /// |
380 /// var event = new SpriteBoxEvent(new Point(50.0, 50.0), 'pointerdown', 0
); | 380 /// var event = new SpriteBoxEvent(new Point(50.0, 50.0), 'pointerdown', 0
); |
381 SpriteBoxEvent(this.boxPosition, this.type, this.pointer); | 381 SpriteBoxEvent(this.boxPosition, this.type, this.pointer); |
382 } | 382 } |
OLD | NEW |