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

Unified Diff: sky/examples/game/lib/texture.dart

Issue 1204783003: Adds basic sprite sheet support to sprites (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Adds basic sprite sheet support to sprites (fixed issues) 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
Index: sky/examples/game/lib/texture.dart
diff --git a/sky/examples/game/lib/texture.dart b/sky/examples/game/lib/texture.dart
new file mode 100644
index 0000000000000000000000000000000000000000..684fdd2b3b66a15123c99e40af395cd7caa4617f
--- /dev/null
+++ b/sky/examples/game/lib/texture.dart
@@ -0,0 +1,33 @@
+part of sprites;
+
+class Texture {
+ final Image image;
+ final Size size;
+ String name;
+ final bool rotated;
+ final bool trimmed;
+
+ Rect frame;
+ Rect spriteSourceSize;
+
+ Point pivot;
+
+ Texture(Image image) :
+ size = new Size(image.width.toDouble(), image.height.toDouble()),
+ image = image,
+ trimmed = false,
+ rotated = false,
+ frame = new Rect.fromLTRB(0.0, 0.0, image.width.toDouble(), image.height.toDouble()),
eseidel 2015/06/23 23:22:31 fromPointAndSize ? I guess Image doesn't have a s
+ spriteSourceSize = new Rect.fromLTRB(0.0, 0.0, image.width.toDouble(), image.height.toDouble()),
+ pivot = new Point(0.5, 0.5);
+
+
+ Texture._fromSpriteFrame(this.image, this.name, this.size, this.rotated, this.trimmed, this.frame,
+ this.spriteSourceSize, this.pivot) {
+ }
+
+ Texture textureFromRect(Rect rect, Point offset, bool rotated) {
+ // TODO: Implement this
+ return null;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698