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

Side by Side Diff: sky/examples/game/lib/sprite_widget.dart

Issue 1201983004: Adds API documentation for SkyGames (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
1 part of sprites; 1 part of sprites;
2 2
3 /// A widget that uses a [SpriteBox] to render a sprite node tree to the screen.
3 class SpriteWidget extends OneChildRenderObjectWrapper { 4 class SpriteWidget extends OneChildRenderObjectWrapper {
4 5
6 /// The rootNode of the sprite node tree.
7 ///
8 /// var node = mySpriteWidget.rootNode;
5 final NodeWithSize rootNode; 9 final NodeWithSize rootNode;
10
11 /// The transform mode used to fit the sprite node tree to the size of the wid get.
6 final SpriteBoxTransformMode transformMode; 12 final SpriteBoxTransformMode transformMode;
7 13
14 /// Creates a new sprite widget with [rootNode] as its content.
15 ///
16 /// The widget will setup the coordinate space for the sprite node tree using the size of the [rootNode] in
17 /// combination with the supplied [transformMode]. By default the letterbox tr ansform mode is used. See
18 /// [SpriteBoxTransformMode] for more details on the different modes.
19 ///
20 /// The most common way to setup the sprite node graph is to subclass [NodeWit hSize] and pass it to the sprite widget.
21 /// In the custom subclass it's possible to build the node graph, do animation s and handle user events.
22 ///
23 /// var mySpriteTree = new MyCustomNodeWithSize();
24 /// var mySpriteWidget = new SpriteWidget(mySpriteTree, SpriteBoxTransform Mode.fixedHeight);
8 SpriteWidget(this.rootNode, [this.transformMode = SpriteBoxTransformMode.lette rbox]); 25 SpriteWidget(this.rootNode, [this.transformMode = SpriteBoxTransformMode.lette rbox]);
9 26
10 SpriteBox get root => super.root; 27 SpriteBox get root => super.root;
11 28
12 SpriteBox createNode() => new SpriteBox(rootNode, transformMode); 29 SpriteBox createNode() => new SpriteBox(rootNode, transformMode);
13 30
14 void syncRenderObject(SpriteWidget old) { 31 void syncRenderObject(SpriteWidget old) {
15 super.syncRenderObject(old); 32 super.syncRenderObject(old);
16 33
17 // SpriteBox doesn't allow mutation of these properties 34 // SpriteBox doesn't allow mutation of these properties
18 assert(rootNode == root.rootNode); 35 assert(rootNode == root.rootNode);
19 assert(transformMode == root.transformMode); 36 assert(transformMode == root._transformMode);
20 } 37 }
21 } 38 }
OLDNEW
« sky/examples/game/lib/node.dart ('K') | « sky/examples/game/lib/sprite_box.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698