OLD | NEW |
1 part of sprites; | 1 part of sprites; |
2 | 2 |
3 /// A Sprite is a [Node] that renders a bitmap image to the screen. | 3 /// A Sprite is a [Node] that renders a bitmap image to the screen. |
4 class Sprite extends NodeWithSize { | 4 class Sprite extends NodeWithSize { |
5 | 5 |
6 /// The texture that the sprite will render to screen. | 6 /// The texture that the sprite will render to screen. |
7 /// | 7 /// |
8 /// If the texture is null, the sprite will be rendered as a red square | 8 /// If the texture is null, the sprite will be rendered as a red square |
9 /// marking the bounds of the sprite. | 9 /// marking the bounds of the sprite. |
10 /// | 10 /// |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 canvas.drawImageRect(texture.image, texture.frame, texture.spriteSourceS
ize, paint); | 120 canvas.drawImageRect(texture.image, texture.frame, texture.spriteSourceS
ize, paint); |
121 } | 121 } |
122 } else { | 122 } else { |
123 // Paint a red square for missing texture | 123 // Paint a red square for missing texture |
124 canvas.drawRect(new Rect.fromLTRB(0.0, 0.0, size.width, size.height), | 124 canvas.drawRect(new Rect.fromLTRB(0.0, 0.0, size.width, size.height), |
125 new Paint()..color = const Color.fromARGB(255, 255, 0, 0)); | 125 new Paint()..color = const Color.fromARGB(255, 255, 0, 0)); |
126 } | 126 } |
127 canvas.restore(); | 127 canvas.restore(); |
128 } | 128 } |
129 } | 129 } |
OLD | NEW |