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

Side by Side Diff: sky/sdk/example/game/main.dart

Issue 1225103009: Fix Asteroids game to paint again and give it an icon. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 import 'package:sky/mojo/activity.dart' as activity;
5 import 'package:sky/mojo/asset_bundle.dart'; 6 import 'package:sky/mojo/asset_bundle.dart';
7 import 'package:sky/theme/colors.dart' as colors;
6 import 'package:sky/widgets/basic.dart'; 8 import 'package:sky/widgets/basic.dart';
7 import 'package:sky/widgets/widget.dart'; 9 import 'package:sky/widgets/widget.dart';
8 10
9 import 'lib/game_demo.dart'; 11 import 'lib/game_demo.dart';
10 import 'lib/sprites.dart'; 12 import 'lib/sprites.dart';
11 13
12 AssetBundle _initBundle() { 14 AssetBundle _initBundle() {
13 if (rootBundle != null) 15 if (rootBundle != null)
14 return rootBundle; 16 return rootBundle;
15 return new NetworkAssetBundle(Uri.base); 17 return new NetworkAssetBundle(Uri.base);
(...skipping 11 matching lines...) Expand all
27 await _loader.load([ 29 await _loader.load([
28 'assets/nebula.png', 30 'assets/nebula.png',
29 'assets/sprites.png', 31 'assets/sprites.png',
30 'assets/starfield.png', 32 'assets/starfield.png',
31 ]); 33 ]);
32 34
33 String json = await _bundle.loadString('assets/sprites.json'); 35 String json = await _bundle.loadString('assets/sprites.json');
34 _spriteSheet = new SpriteSheet(_loader['assets/sprites.png'], json); 36 _spriteSheet = new SpriteSheet(_loader['assets/sprites.png'], json);
35 _app = new GameDemoApp(); 37 _app = new GameDemoApp();
36 38
39 // TODO(viktork): This task bar color is the wrong purple.
40 activity.updateTaskDescription('Asteroids', colors.Purple[500]);
abarth-chromium 2015/07/10 20:24:54 Why not use a widget in the GameDemoApp?
37 runApp(_app); 41 runApp(_app);
38 } 42 }
39 43
40 class GameDemoApp extends App { 44 class GameDemoApp extends App {
41 45
42 Widget build() { 46 Widget build() {
43 return new Stack([ 47 return new Stack([
44 new SpriteWidget(new GameDemoWorld(_app, _loader, _spriteSheet)), 48 new SpriteWidget(new GameDemoWorld(_app, _loader, _spriteSheet)),
45 // new StackPositionedChild( 49 // new StackPositionedChild(
46 // new Flex([ 50 // new Flex([
47 // new FlexExpandingChild( 51 // new FlexExpandingChild(
48 // new RaisedButton(child:new Text("Hello")), 52 // new RaisedButton(child:new Text("Hello")),
49 // key: 1 53 // key: 1
50 // ), 54 // ),
51 // new FlexExpandingChild( 55 // new FlexExpandingChild(
52 // new RaisedButton(child:new Text("Foo!")), 56 // new RaisedButton(child:new Text("Foo!")),
53 // key: 2 57 // key: 2
54 // ) 58 // )
55 // ]), 59 // ]),
56 // right:0.0, 60 // right:0.0,
57 // top: 20.0 61 // top: 20.0
58 // ) 62 // )
59 ]); 63 ]);
60 } 64 }
61 } 65 }
62 66
63 void resetGame() { 67 void resetGame() {
64 _app.scheduleBuild(); 68 _app.scheduleBuild();
65 } 69 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698