diff options
author | Cristhofer Travieso <cristhofert97@gmail.com> | 2013-06-11 23:38:36 (GMT) |
---|---|---|
committer | Cristhofer Travieso <cristhofert97@gmail.com> | 2013-06-11 23:38:36 (GMT) |
commit | 1320ee2e3a15317597bdc845334ed8a1126b1077 (patch) | |
tree | 346a3ec9e89bd9a98e0d9db6b7381fe29b6dc36a | |
parent | 6d27c08e0b8c32cf5a59d4f17793899d4d0d31d9 (diff) |
Remplace enemy to opponent and add a grid and some button
Signed-off-by: Cristhofer Travieso <cristhofert97@gmail.com>
-rw-r--r-- | game.py | 74 |
1 files changed, 50 insertions, 24 deletions
@@ -19,44 +19,70 @@ from gi.repository import Gtk from gi.repository import GObject -sugar = False -if sugar: - from sugar3.graphics import style - SIZE = style.zoom(150) - BETWEEN_LINE_SPACE = style.zoom(200) -else: - SIZE = 0 - BETWEEN_LINE_SPACE = 0 -LINE_WIDTH = 12 - -BACKGROUND_COLOR = (0, 1, 0) - class Fixed(Gtk.Fixed): def __init__(self): Gtk.Fixed.__init__(self) - + + alloc = self.get_allocation() + width = alloc.width() + + #opponent cards + opponent_card1 = Card() + self.put(opponent_card1, width/2, 0) + opponent_card2 = Card() + self.put(opponent_card2, width/2, 10) + opponent_card3 = Card() + self.put(opponent_card3, width/2, 20) + #my cards card1 = Card() + self.put(card1, width/2, 60) card2 = Card() + self.put(card2, width/2, 70) card3 = Card() - - #enemy cards - enemy_card1 = Card() - enemy_card2 = Card() - enemy_card3 = Card() - - #deck - deck = Gtk.Card() + self.put(card3, width/2, 80) #sample sample = Gtk.Image() + self.put(sample, 10, 50) + + #deck + deck = Gtk.Image() + self.put(deck, 0, 50) + + grid = Gtk.Grid() + self.put(grid, 1000, 500) + + truco_btn = Gtk.Button('Truco') + grid.next(truco_btn) + + retruco_btn = Gtk.Button('Retruco') + grid.next(retruco_btn) + + vale4_btn = Gtk.Button('Vale 4') + grid.next(vale4_btn) + + flor_btn = Gtk.Button('Vale 4') + grid.next(flor_btn) class Card(Gtk.Button): def __init__(self): - Gtk.Button.__int__(self) - + Gtk.Button.__init__(self) + self.image = Gtk.Image() - self.add(image) + self.add(self.image) + + self.x = 0#obtener posicion de la carta + self.y = 0#obtener posicion de la carta + + def play(self, center): + fixed.move(self, center[0]/2, center[1]/2) + + def back(self): + fixed.move(self, self.x, self.y) + +#def repartir(): + #repartir cartas |