From 82051ae58ce50fc333b8840bb1eacf787c496c37 Mon Sep 17 00:00:00 2001 From: Gonzalo Odiard Date: Tue, 19 Aug 2014 01:45:29 +0000 Subject: Paint the background with a wood texture --- diff --git a/TODO b/TODO index d0987be..c90a271 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,21 @@ +DONE 2014 +* Ported to gtk3 +* Reworked game use +* Remove Help screen +* Try place piece on click +* Fix piece LEFT drawn over DOWN + +TODO 2014: + +* When game finish, disable pass and add buttons +* Fix: Check end game +* Fix Show points +* Fix Pass button is disabled +* Replace combo +* Save state? +* Implement collab + + HECHO: 1er etapa: juego funcional para un usuario diff --git a/dominoactivity.py b/dominoactivity.py index 2361e13..932271d 100644 --- a/dominoactivity.py +++ b/dominoactivity.py @@ -251,8 +251,14 @@ class Domino(activity.Activity): dominoview.SCREEN_HEIGHT) surf_ctx = cairo.Context(self.surface) - if (self.game.table): - self.game.table.paint(surf_ctx) + wood_surf = cairo.ImageSurface.create_from_png("images/wood.png") + + back_pattern = cairo.SurfacePattern(wood_surf) + back_pattern.set_extend(cairo.EXTEND_REPEAT) + surf_ctx.rectangle(0, 0, dominoview.SCREEN_WIDTH, + dominoview.SCREEN_HEIGHT) + surf_ctx.set_source(back_pattern) + surf_ctx.fill() # sort from top left, to bottom right to not overdraw visually for piece in sorted(self.game.placed_pieces, key=attrgetter('x', 'y')): diff --git a/dominoview.py b/dominoview.py index 7696e6d..b3b24bf 100644 --- a/dominoview.py +++ b/dominoview.py @@ -63,35 +63,6 @@ class DominoTableView(): self.bottom_limit = self._margin_y + SIZE * self.cantY print "Table cantX", self.cantX, "cantY", self.cantY - def paint(self, ctx): - - # agrego 5,5 para que la grilla quede en la base de las piezas - # (por la perspectiva) - alto = 5 - - ctx.rectangle(self._margin_x + alto, self._margin_y + alto, - SIZE * self.cantX + alto, - SIZE * self.cantY + alto) - ctx.set_source_rgb(204.0/255.0, 204.0/255.0, 204.0/255.0) - ctx.fill() - - ctx.set_line_width(1) - ctx.set_source_rgb(1, 1, 0) - - for n in range(0, self.cantY): - ctx.move_to(self._margin_x + alto, - self._margin_y + alto + n * SIZE) - ctx.line_to(self._margin_x + alto + SIZE * self.cantX, - self._margin_y + alto + n * SIZE) - ctx.stroke() - - for n in range(0, self.cantX): - ctx.move_to(self._margin_x + n * SIZE + alto, - self._margin_y + alto) - ctx.line_to(self._margin_x + n * SIZE + alto, - self.bottom_limit + alto) - ctx.stroke() - def show_values(self, ctx, tiles): """ To debug: display the value in every tile off the table matrix diff --git a/images/wood.png b/images/wood.png new file mode 100644 index 0000000..a1052a8 --- /dev/null +++ b/images/wood.png Binary files differ -- cgit v0.9.1