Clean up changes to use 0-52 card encoding.

This commit is contained in:
Ray 2009-06-18 14:11:53 -04:00
parent 42f2b73c1a
commit a6a98a750f

View File

@ -76,18 +76,19 @@ class Aux_Window:
for j in range(0, 13): for j in range(0, 13):
for i in range(0, 4): for i in range(0, 4):
temp_pb = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, pb.get_has_alpha(), pb.get_bits_per_sample(), 30, 42) card_images[Card.cardFromValueSuit(ranks[j], suits[i])] = self.cropper(pb, i, j)
pb.copy_area(30*j, 42*i, 30, 42, temp_pb, 0, 0)
card_images[Card.cardFromValueSuit(ranks[j], suits[i])] = temp_pb
temp_pb = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, pb.get_has_alpha(), pb.get_bits_per_sample(), 30, 42) temp_pb = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, pb.get_has_alpha(), pb.get_bits_per_sample(), 30, 42)
# also pick out a card back and store in [0] # also pick out a card back and store in [0]
j = 13 card_images[0] = self.cropper(pb, 2, 13)
i = 2
pb.copy_area(30*j, 42*i, 30, 42, temp_pb, 0, 0)
card_images[0] = temp_pb
return(card_images) return(card_images)
# cards are 30 wide x 42 high # cards are 30 wide x 42 high
def cropper(self, pb, i, j):
"""Crop out a card image given an FTP deck and the i, j position."""
temp_pb = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, pb.get_has_alpha(), pb.get_bits_per_sample(), 30, 42)
pb.copy_area(30*j, 42*i, 30, 42, temp_pb, 0, 0)
return temp_pb
def split_cards(self, card): def split_cards(self, card):
if card == 'xx': return ('B', 'S') if card == 'xx': return ('B', 'S')
return (card[0], card[1].upper()) return (card[0], card[1].upper())