Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/game.py
blob: acbde8cde7f66ae72b3348c265481c801f80a439 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#!/usr/bin/env python

# Copyright (C) 2013 Cristhofer Travieso <cristhofert97@gmail.com>

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GObject

WIDTH = 1200
HEIGHT = 700

class Eventbox(Gtk.EventBox):
    def __init__(self):
        Gtk.EventBox.__init__(self)

        parse, color = Gdk.Color.parse('green')
        self.modify_bg(Gtk.StateType.NORMAL, color)

        self.add(Fixed())
        self.show()

class Fixed(Gtk.Fixed):

    def __init__(self):
        Gtk.Fixed.__init__(self)

        #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 = MyCard()
        card1.connect('clicked', self.play_card)
        self.put(card1, WIDTH/2, HEIGHT-10)
      
        card2 = MyCard()
        card2.connect('clicked', self.play_card)
        self.put(card2, WIDTH/2, HEIGHT-20)

        card3 = MyCard()
        card3.connect('clicked', self.play_card)
        self.put(card3, WIDTH/2, HEIGHT-30)

        #sample
        sample = Gtk.Image()
        self.put(sample, 10, 50)

        #deck
        deck = Gtk.Image()
        self.put(deck, 0, 50)
        self.show()
        
        #button
        box = Gtk.VBox()
        self.put(box, WIDTH-100, HEIGHT-100)

        truco_box = Gtk.HBox()
        box.add(truco_box)

        truco_btn = Gtk.Button('Truco')
        truco_box.add(truco_btn)

        retruco_btn = Gtk.Button('Retruco')
        truco_box.add(retruco_btn)

        vale4_btn = Gtk.Button('Vale 4')
        truco_box.add(vale4_btn)

        other_box = Gtk.HBox()
        box.add(other_box)
        
        flor_btn = Gtk.Button('Flor')
        other_box.add(flor_btn)
        
        box.show_all()
        self.show()

    def deal(self):
        pass

    def play_card(self, widget):
        self.move(widget, WIDTH/2, HEIGHT/2+100)

    def back(self):
        fixed.move(self, self.x, self.y)

class Card(Gtk.Button):

    def __init__(self):
        Gtk.Button.__init__(self)

        self.image = Gtk.Image()
        self.add(self.image)

        self.x = 0#obtener posicion de la carta
        self.y = 0#obtener posicion de la carta

    def back(self):
        fixed.move(self, self.x, self.y)

#def repartir():
    #repartir cartas


class MyCard(Gtk.Button):

    def __init__(self):
        Gtk.Button.__init__(self)
                
        self.image = Gtk.Image()
        self.add(self.image)

        self.x = 0#obtener posicion de la carta
        self.y = 0#obtener posicion de la carta


#def repartir():
    #repartir cartas