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

Unified 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 side-by-side diff with in-line comments
Download patch
« sky/examples/game/lib/node.dart ('K') | « sky/examples/game/lib/sprite_box.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/examples/game/lib/sprite_widget.dart
diff --git a/sky/examples/game/lib/sprite_widget.dart b/sky/examples/game/lib/sprite_widget.dart
index 11a06a3670afc97d21083cd6fd0b01d1370fbc74..95934ae75948356481efa091fa72e69359881400 100644
--- a/sky/examples/game/lib/sprite_widget.dart
+++ b/sky/examples/game/lib/sprite_widget.dart
@@ -1,10 +1,27 @@
part of sprites;
+/// A widget that uses a [SpriteBox] to render a sprite node tree to the screen.
class SpriteWidget extends OneChildRenderObjectWrapper {
+ /// The rootNode of the sprite node tree.
+ ///
+ /// var node = mySpriteWidget.rootNode;
final NodeWithSize rootNode;
+
+ /// The transform mode used to fit the sprite node tree to the size of the widget.
final SpriteBoxTransformMode transformMode;
+ /// Creates a new sprite widget with [rootNode] as its content.
+ ///
+ /// The widget will setup the coordinate space for the sprite node tree using the size of the [rootNode] in
+ /// combination with the supplied [transformMode]. By default the letterbox transform mode is used. See
+ /// [SpriteBoxTransformMode] for more details on the different modes.
+ ///
+ /// The most common way to setup the sprite node graph is to subclass [NodeWithSize] and pass it to the sprite widget.
+ /// In the custom subclass it's possible to build the node graph, do animations and handle user events.
+ ///
+ /// var mySpriteTree = new MyCustomNodeWithSize();
+ /// var mySpriteWidget = new SpriteWidget(mySpriteTree, SpriteBoxTransformMode.fixedHeight);
SpriteWidget(this.rootNode, [this.transformMode = SpriteBoxTransformMode.letterbox]);
SpriteBox get root => super.root;
@@ -16,6 +33,6 @@ class SpriteWidget extends OneChildRenderObjectWrapper {
// SpriteBox doesn't allow mutation of these properties
assert(rootNode == root.rootNode);
- assert(transformMode == root.transformMode);
+ assert(transformMode == root._transformMode);
}
}
« 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