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

Unified Diff: samples/third_party/pop-pop-win/lib/src/canvas/board_element.dart

Issue 200723008: samples/poppopwin: upgrade to first-class sample (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fixed pkgbuild.status for rename Created 6 years, 9 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: samples/third_party/pop-pop-win/lib/src/canvas/board_element.dart
diff --git a/samples/third_party/pop-pop-win/lib/src/canvas/board_element.dart b/samples/third_party/pop-pop-win/lib/src/canvas/board_element.dart
deleted file mode 100644
index 0afb2a965412972f1861d1692bc456e5ac46bc2b..0000000000000000000000000000000000000000
--- a/samples/third_party/pop-pop-win/lib/src/canvas/board_element.dart
+++ /dev/null
@@ -1,63 +0,0 @@
-part of ppw_canvas;
-
-class BoardElement extends ParentThing {
- Array2d<SquareElement> _elements;
-
- BoardElement() : super(0, 0) {
- cacheEnabled = true;
- }
-
- int get visualChildCount {
- if(_elements == null) {
- return 0;
- } else {
- return _elements.length;
- }
- }
-
- Thing getVisualChild(int index) {
- return _elements[index];
- }
-
- void update() {
- if(_game == null) {
- _elements = null;
- } else if(_elementsNeedUpdate) {
- _elements = new Array2d<SquareElement>(
- _game.field.width, _game.field.height);
-
- for(int i=0;i<_elements.length;i++) {
- final coords = _elements.getCoordinate(i);
- final se = new SquareElement(coords.item1, coords.item2);
- se.registerParent(this);
-
- _gameElement.wireSquareMouseEvent(se);
-
- // position the square
- final etx = se.addTransform();
- etx.setToTranslation(coords.item1 * SquareElement._size,
- coords.item2 * SquareElement._size);
-
- _elements[i] = se;
- }
-
- size = new Size(_game.field.width * SquareElement._size,
- _game.field.height * SquareElement._size);
- }
- super.update();
- }
-
- GameElement get _gameElement => (parent as CanvasThing).parent;
-
- Game get _game => _gameElement._game;
-
- bool get _elementsNeedUpdate {
- assert(_game != null);
- return _elements == null ||
- _elements.width != _game.field.width ||
- _elements.height != _game.field.height;
- }
-
- TextureData get _textureData => _gameElement._textureData;
-
-}
« no previous file with comments | « samples/third_party/pop-pop-win/lib/poppopwin.dart ('k') | samples/third_party/pop-pop-win/lib/src/canvas/game_audio.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698