| OLD | NEW |
| 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/asset_bundle.dart'; | 5 import 'package:sky/mojo/asset_bundle.dart'; |
| 6 import 'package:sky/theme/colors.dart' as colors; |
| 6 import 'package:sky/widgets/basic.dart'; | 7 import 'package:sky/widgets/basic.dart'; |
| 7 import 'package:sky/widgets/widget.dart'; | 8 import 'package:sky/widgets/widget.dart'; |
| 9 import 'package:sky/widgets/task_description.dart'; |
| 10 import 'package:sky/widgets/theme.dart'; |
| 8 | 11 |
| 9 import 'lib/game_demo.dart'; | 12 import 'lib/game_demo.dart'; |
| 10 import 'lib/sprites.dart'; | 13 import 'lib/sprites.dart'; |
| 11 | 14 |
| 12 AssetBundle _initBundle() { | 15 AssetBundle _initBundle() { |
| 13 if (rootBundle != null) | 16 if (rootBundle != null) |
| 14 return rootBundle; | 17 return rootBundle; |
| 15 return new NetworkAssetBundle(Uri.base); | 18 return new NetworkAssetBundle(Uri.base); |
| 16 } | 19 } |
| 17 | 20 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 33 String json = await _bundle.loadString('assets/sprites.json'); | 36 String json = await _bundle.loadString('assets/sprites.json'); |
| 34 _spriteSheet = new SpriteSheet(_loader['assets/sprites.png'], json); | 37 _spriteSheet = new SpriteSheet(_loader['assets/sprites.png'], json); |
| 35 _app = new GameDemoApp(); | 38 _app = new GameDemoApp(); |
| 36 | 39 |
| 37 runApp(_app); | 40 runApp(_app); |
| 38 } | 41 } |
| 39 | 42 |
| 40 class GameDemoApp extends App { | 43 class GameDemoApp extends App { |
| 41 | 44 |
| 42 Widget build() { | 45 Widget build() { |
| 43 return new Stack([ | 46 // TODO(viktork): The task bar purple is the wrong purple, we may need |
| 44 new SpriteWidget(new GameDemoWorld(_app, _loader, _spriteSheet)), | 47 // a custom theme swatch to match the purples in the sprites. |
| 45 // new StackPositionedChild( | 48 ThemeData theme = new ThemeData( |
| 46 // new Flex([ | 49 brightness: ThemeBrightness.light, |
| 47 // new FlexExpandingChild( | 50 primarySwatch: colors.Purple |
| 48 // new RaisedButton(child:new Text("Hello")), | 51 ); |
| 49 // key: 1 | 52 |
| 50 // ), | 53 return new Theme( |
| 51 // new FlexExpandingChild( | 54 data: theme, |
| 52 // new RaisedButton(child:new Text("Foo!")), | 55 child: new TaskDescription( |
| 53 // key: 2 | 56 label: 'Asteroids', |
| 54 // ) | 57 child: new SpriteWidget( |
| 55 // ]), | 58 new GameDemoWorld(_app, _loader, _spriteSheet) |
| 56 // right:0.0, | 59 ) |
| 57 // top: 20.0 | 60 ) |
| 58 // ) | 61 ); |
| 59 ]); | |
| 60 } | 62 } |
| 61 } | 63 } |
| 62 | 64 |
| 63 void resetGame() { | 65 void resetGame() { |
| 64 _app.scheduleBuild(); | 66 _app.scheduleBuild(); |
| 65 } | 67 } |
| OLD | NEW |