OLD | NEW |
| (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; | |
OLD | NEW |