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

Unified Diff: sky/examples/game/lib/game_world.dart

Issue 1149183004: Sky example game enhancements, adds preloading of images and adds transform modes to SpriteBox (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Fixes setting parameter with sugar Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sky/examples/game/lib/image_map.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/examples/game/lib/game_world.dart
diff --git a/sky/examples/game/lib/game_world.dart b/sky/examples/game/lib/game_world.dart
index 2ce13ddcc5aca69194ed0b3da9ffebb1097dc38d..e066db98dda89e86fdd3db1bfa84cde4740bb3e7 100644
--- a/sky/examples/game/lib/game_world.dart
+++ b/sky/examples/game/lib/game_world.dart
@@ -6,28 +6,22 @@ class GameWorld extends TransformNode {
List<Body> bodies = [];
Image _image;
- GameWorld(double width, double height) {
- this.width = width;
- this.height = height;
+ GameWorld(ImageMap images) {
+ this.width = 1024.0;
+ this.height = 1024.0;
world = new World.withGravity(new Vector2(0.0, 0.0));
// Load and add background
- Image imgBg = new Image()..src="https://raw.githubusercontent.com/slembcke/GalacticGuardian.spritebuilder/GDC/Packages/SpriteBuilder%20Resources.sbpack/resources-auto/BurnTexture.png";
+ Image imgBg = images["https://raw.githubusercontent.com/slembcke/GalacticGuardian.spritebuilder/GDC/Packages/SpriteBuilder%20Resources.sbpack/resources-auto/BurnTexture.png"];
SpriteNode sprtBg = new SpriteNode.withImage(imgBg);
sprtBg.width = width;
sprtBg.height = height;
sprtBg.pivot = new Vector2(0.0, 0.0);
this.children.add(sprtBg);
- SpriteNode sprtCenter = new SpriteNode.withImage(imgBg);
- sprtCenter.width = 32.0;
- sprtCenter.height = 32.0;
- sprtCenter.position = new Vector2(512.0, 512.0);
- this.children.add(sprtCenter);
-
// Load asteroid image
- _image = new Image()..src="https://raw.githubusercontent.com/slembcke/GalacticGuardian.spritebuilder/GDC/Packages/SpriteBuilder%20Resources.sbpack/Sprites/resources-auto/asteroid_big_002.png";
+ _image = images["https://raw.githubusercontent.com/slembcke/GalacticGuardian.spritebuilder/GDC/Packages/SpriteBuilder%20Resources.sbpack/Sprites/resources-auto/asteroid_big_002.png"];
// Add some asteroids to the game world
for (int i = 0; i < 50; i++) {
« no previous file with comments | « no previous file | sky/examples/game/lib/image_map.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698