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

Side by Side Diff: sky/examples/game/main.dart

Issue 1218593002: Move sky/examples to sky/sdk/lib/example, and code changes to support that change. Fixes T277. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 6 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
(Empty)
1 import 'dart:sky';
2
3 import 'package:sky/widgets/basic.dart';
4 import 'package:sky/widgets/raised_button.dart';
5 import 'package:sky/widgets/widget.dart';
6 import 'package:sky/framework/net/fetch.dart';
7
8 import 'lib/game_demo.dart';
9 import 'lib/sprites.dart';
10
11 void main() {
12 // Load images
13 new ImageMap([
14 "res/nebula.png",
15 "res/sprites.png",
16 ],
17 allImagesLoaded);
18 }
19
20 void allImagesLoaded(ImageMap loader) {
21 _loader = loader;
22
23 fetchBody("res/sprites.json").then((Response response) {
24 String json = response.bodyAsString();
25 _spriteSheet = new SpriteSheet(_loader["res/sprites.png"], json);
26 allResourcesLoaded();
27 });
28 }
29
30 void allResourcesLoaded() {
31 runApp(new GameDemoApp());
32 }
33
34 class GameDemoApp extends App {
35
36 Widget build() {
37 return new Stack([
38 new SpriteWidget(new GameDemoWorld(_loader, _spriteSheet)),
39 // new StackPositionedChild(
40 // new Flex([
41 // new FlexExpandingChild(
42 // new RaisedButton(child:new Text("Hello")),
43 // key: 1
44 // ),
45 // new FlexExpandingChild(
46 // new RaisedButton(child:new Text("Foo!")),
47 // key: 2
48 // )
49 // ]),
50 // right:0.0,
51 // top: 20.0
52 // )
53 ]);
54 }
55 }
56
57 ImageMap _loader;
58 SpriteSheet _spriteSheet;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698