Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Side by Side Diff: sky/sdk/example/game/lib/particle_system.dart

Issue 1223543004: Adds better explosions, shield, and game over (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: git cl web Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/sdk/example/game/lib/node_with_size.dart ('k') | sky/sdk/example/game/main.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 part of sprites; 1 part of sprites;
2 2
3 class _Particle { 3 class _Particle {
4 Vector2 pos; 4 Vector2 pos;
5 Vector2 startPos; 5 Vector2 startPos;
6 6
7 double colorPos; 7 double colorPos;
8 double deltaColorPos; 8 double deltaColorPos;
9 9
10 double size; 10 double size;
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 } 276 }
277 277
278 double randMinus1To1() => _rand.nextDouble() * 2.0 - 1.0; 278 double randMinus1To1() => _rand.nextDouble() * 2.0 - 1.0;
279 } 279 }
280 280
281 // TODO: Needs bindings to Skia method in SkCanvas (exclude canvas parameter) 281 // TODO: Needs bindings to Skia method in SkCanvas (exclude canvas parameter)
282 void drawAtlas(Canvas canvas, Image image, List<RSTransform> transforms, List<Re ct> rects, List<Color> colors, 282 void drawAtlas(Canvas canvas, Image image, List<RSTransform> transforms, List<Re ct> rects, List<Color> colors,
283 TransferMode transferMode, Paint paint) { 283 TransferMode transferMode, Paint paint) {
284 assert(transforms.length == rects.length && transforms.length == colors.length ); 284 assert(transforms.length == rects.length && transforms.length == colors.length );
285 285
286 Paint paint = new Paint();
287
288 Texture mainTexture = new Texture(image); 286 Texture mainTexture = new Texture(image);
289 287
290 for (int i = 0; i < transforms.length; i++) { 288 for (int i = 0; i < transforms.length; i++) {
291 RSTransform transform = transforms[i]; 289 RSTransform transform = transforms[i];
292 Rect rect = rects[i]; 290 Rect rect = rects[i];
293 Color color = colors[i]; 291 Color color = colors[i];
294 292
295 canvas.save(); 293 canvas.save();
296 294
297 Matrix4 matrix = new Matrix4(transform.scos, transform.ssin, 0.0, 0.0, 295 Matrix4 matrix = new Matrix4(transform.scos, transform.ssin, 0.0, 0.0,
(...skipping 14 matching lines...) Expand all
312 310
313 // TODO: Needs bindings to Skia SkRSXform 311 // TODO: Needs bindings to Skia SkRSXform
314 class RSTransform { 312 class RSTransform {
315 double scos; 313 double scos;
316 double ssin; 314 double ssin;
317 double tx; 315 double tx;
318 double ty; 316 double ty;
319 317
320 RSTransform(this.scos, this.ssin, this.tx, this.ty); 318 RSTransform(this.scos, this.ssin, this.tx, this.ty);
321 } 319 }
OLDNEW
« no previous file with comments | « sky/sdk/example/game/lib/node_with_size.dart ('k') | sky/sdk/example/game/main.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698