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

Unified Diff: samples/pop_pop_win/lib/src/canvas/game_background_element.dart

Issue 242443008: samples/pop_pop_win: now based on StageXL (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: tiny nit Created 6 years, 8 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/pop_pop_win/lib/src/canvas/game_background_element.dart
diff --git a/samples/pop_pop_win/lib/src/canvas/game_background_element.dart b/samples/pop_pop_win/lib/src/canvas/game_background_element.dart
deleted file mode 100644
index 20358cae2e01153f00b2ec2cad0521ec769b7c1d..0000000000000000000000000000000000000000
--- a/samples/pop_pop_win/lib/src/canvas/game_background_element.dart
+++ /dev/null
@@ -1,91 +0,0 @@
-part of pop_pop_win.canvas;
-
-class GameBackgroundElement extends Thing {
- GameBackgroundElement(): super(0, 0) {
- cacheEnabled = true;
- }
-
- void update() {
- if (size != this._gameElement.size) {
- size = this._gameElement.size;
- }
- }
-
- void drawOverride(CanvasRenderingContext2D ctx) {
- final rightBgLoc = SquareElement._size * (_gameElement._game.field.width -1) +
- GameElement._edgeOffset;
- final bottomBgLoc = SquareElement._size * (_gameElement._game.field.height -1) +
- GameElement._edgeOffset;
-
- ctx.save();
- ctx.translate(_gameElement._scaledBoardOffset.x, _gameElement._scaledBoardOffset.y);
-
- _textureData.drawTextureKeyAt(ctx, 'game_board_corner_top_left.png');
-
- _textureData.drawTextureKeyAt(ctx, 'game_board_corner_top_right.png',
- new Coordinate(rightBgLoc, 0));
-
- _textureData.drawTextureKeyAt(ctx, 'game_board_corner_bottom_left.png',
- new Coordinate(0, bottomBgLoc));
- _textureData.drawTextureKeyAt(ctx, 'game_board_corner_bottom_right.png',
- new Coordinate(rightBgLoc, bottomBgLoc));
-
- for (var i = 1; i < _gameElement._game.field.width - 1; i++) {
- final xLoc = SquareElement._size * i + GameElement._edgeOffset;
- _textureData.drawTextureKeyAt(ctx, 'game_board_side_top.png',
- new Coordinate(xLoc, 0));
- _textureData.drawTextureKeyAt(ctx, 'game_board_side_bottom.png',
- new Coordinate(xLoc, bottomBgLoc));
- }
-
- for (var i = 1; i < _gameElement._game.field.height - 1; i++) {
- final yLoc = SquareElement._size * i + GameElement._edgeOffset;
- _textureData.drawTextureKeyAt(ctx, 'game_board_side_left.png',
- new Coordinate(0, yLoc));
- _textureData.drawTextureKeyAt(ctx, 'game_board_side_right.png',
- new Coordinate(rightBgLoc, yLoc));
- }
-
- ctx.restore();
-
- //
- // start drawing corners
- //
-
- ctx.save();
- // top left
- ctx.transform(_gameElement._scale, 0, 0, _gameElement._scale, 0, 0);
- _drawCorner(ctx);
-
- // right flip
- ctx.save();
- ctx.transform(-1, 0, 0, 1, GameElement._backgroundSize.width, 0);
- _drawCorner(ctx);
-
- // nested bottom, right flip
- ctx.transform(1, 0, 0, -1, 0, GameElement._backgroundSize.height);
- _drawCorner(ctx);
-
- ctx.restore();
-
- // bottom left
- ctx.transform(1, 0, 0, -1, 0, GameElement._backgroundSize.height);
- _drawCorner(ctx);
-
- ctx.restore();
-
- //
- // end drawing corners
- //
- }
-
- void _drawCorner(CanvasRenderingContext2D ctx) {
- _textureData.drawTextureKeyAt(ctx, 'background_top_left.png');
- _textureData.drawTextureKeyAt(ctx, 'background_side_left.png',
- new Coordinate(0, GameElement._boardOffset.y));
- }
-
- GameElement get _gameElement => (parent as CanvasThing).parent;
-
- TextureData get _textureData => _gameElement._textureData;
-}
« no previous file with comments | « samples/pop_pop_win/lib/src/canvas/game_audio.dart ('k') | samples/pop_pop_win/lib/src/canvas/game_element.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698