mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
Moved text displays to limit auto-scaling overlap.
This commit is contained in:
parent
6b00824e64
commit
41edf474d6
12 changed files with 64 additions and 56 deletions
|
@ -106,16 +106,20 @@ class Canfield(Game):
|
|||
|
||||
# create stacks
|
||||
x, y = lay.XM, lay.YM
|
||||
if round_text:
|
||||
y += lay.TEXT_HEIGHT
|
||||
s.talon = self.Talon_Class(x, y, self,
|
||||
max_rounds=max_rounds, num_deal=num_deal)
|
||||
lay.createText(s.talon, "s")
|
||||
if round_text:
|
||||
lay.createRoundText(s.talon, 'sss')
|
||||
lay.createRoundText(s.talon, 'n')
|
||||
x += lay.XS
|
||||
s.waste = WasteStack(x, y, self)
|
||||
lay.createText(s.waste, "s")
|
||||
x += lay.XM
|
||||
y = lay.YM
|
||||
if round_text:
|
||||
y += lay.TEXT_HEIGHT
|
||||
if (self.SEPARATE_FOUNDATIONS):
|
||||
for i in range(4):
|
||||
for j in range(decks):
|
||||
|
@ -143,6 +147,8 @@ class Canfield(Game):
|
|||
s.reserves.append(self.ReserveStack_Class(x, y, self))
|
||||
s.reserves[0].CARD_YOFFSET = yoffset
|
||||
x, y = lay.XM + 2 * lay.XS + lay.XM, lay.YM + lay.YS
|
||||
if round_text:
|
||||
y += lay.TEXT_HEIGHT
|
||||
if text:
|
||||
y += lay.TEXT_HEIGHT
|
||||
for i in range(rows):
|
||||
|
|
|
@ -491,22 +491,23 @@ class EightPacks(Game):
|
|||
|
||||
def createGame(self, max_rounds=3, width=10, playcards=14):
|
||||
l, s = Layout(self), self.s
|
||||
self.setSize(l.XM+width*l.XS,
|
||||
l.YM+2*l.YS+l.TEXT_HEIGHT+playcards*l.YOFFSET)
|
||||
self.setSize(l.XM + width * l.XS,
|
||||
l.YM + 2 * l.YS + (2 * l.TEXT_HEIGHT) +
|
||||
playcards * l.YOFFSET)
|
||||
|
||||
x, y = l.XM, l.YM
|
||||
for i in range(10):
|
||||
s.rows.append(self.RowStack_Class(x, y, self, dir=1))
|
||||
x += l.XS
|
||||
|
||||
x, y = self.width-l.XS, self.height-l.YS
|
||||
x, y = self.width - l.XS, self.height - l.YS - l.TEXT_HEIGHT
|
||||
s.talon = WasteTalonStack(x, y, self, max_rounds=max_rounds)
|
||||
l.createText(s.talon, 'n')
|
||||
l.createRoundText(s.talon, 'nnn')
|
||||
l.createText(s.talon, 's')
|
||||
l.createRoundText(s.talon, 'n')
|
||||
|
||||
x -= l.XS
|
||||
s.waste = WasteStack(x, y, self)
|
||||
l.createText(s.waste, 'n')
|
||||
l.createText(s.waste, 's')
|
||||
|
||||
l.defaultStackGroups()
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ class Diplomat(Game):
|
|||
l, s = Layout(self), self.s
|
||||
|
||||
# set window
|
||||
self.setSize(l.XM+8*l.XS, l.YM+3*l.YS+12*l.YOFFSET+l.TEXT_HEIGHT)
|
||||
self.setSize(l.XM+8*l.XS, l.YM+3*l.YS+12*l.YOFFSET+(2 * l.TEXT_HEIGHT))
|
||||
|
||||
# create stacks
|
||||
x, y = l.XM, l.YM
|
||||
|
@ -70,14 +70,14 @@ class Diplomat(Game):
|
|||
for i in range(8):
|
||||
s.rows.append(self.RowStack_Class(x, y, self))
|
||||
x = x + l.XS
|
||||
x, y, = l.XM, self.height - l.YS
|
||||
x, y, = l.XM, self.height - l.YS - l.TEXT_HEIGHT
|
||||
s.talon = WasteTalonStack(x, y, self, max_rounds=max_rounds)
|
||||
l.createText(s.talon, "n")
|
||||
l.createText(s.talon, "s")
|
||||
if max_rounds > 1:
|
||||
l.createRoundText(self.s.talon, 'nnn')
|
||||
l.createRoundText(self.s.talon, 'n')
|
||||
x = x + l.XS
|
||||
s.waste = WasteStack(x, y, self)
|
||||
l.createText(s.waste, "n")
|
||||
l.createText(s.waste, "s")
|
||||
|
||||
# define stack-groups
|
||||
l.defaultStackGroups()
|
||||
|
|
|
@ -90,7 +90,7 @@ class FortyThieves(Game):
|
|||
# (piles up to 12 cards are playable without overlap
|
||||
# in default window size)
|
||||
h = max(2*l.YS, l.YS+(playcards-1)*l.YOFFSET)
|
||||
self.setSize(w1, l.YM + l.YS + h + l.YS + l.TEXT_HEIGHT)
|
||||
self.setSize(w1, l.YM + l.YS + h + l.YS + (2 * l.TEXT_HEIGHT))
|
||||
|
||||
# create stacks
|
||||
# foundations
|
||||
|
@ -111,16 +111,16 @@ class FortyThieves(Game):
|
|||
x = x + l.XS
|
||||
# talon, waste
|
||||
x = self.width - l.XS
|
||||
y = self.height - l.YS
|
||||
y = self.height - l.YS - l.TEXT_HEIGHT
|
||||
s.talon = WasteTalonStack(x, y, self,
|
||||
max_rounds=max_rounds, num_deal=num_deal)
|
||||
l.createText(s.talon, "n")
|
||||
l.createText(s.talon, "s")
|
||||
if max_rounds > 1:
|
||||
l.createRoundText(s.talon, 'nnn')
|
||||
l.createRoundText(s.talon, 'n')
|
||||
x -= l.XS
|
||||
s.waste = WasteStack(x, y, self)
|
||||
s.waste.CARD_XOFFSET = -l.XOFFSET
|
||||
l.createText(s.waste, "n")
|
||||
l.createText(s.waste, "s")
|
||||
|
||||
# define stack-groups
|
||||
l.defaultStackGroups()
|
||||
|
|
|
@ -275,20 +275,20 @@ class DoubleFives(Glenwood):
|
|||
|
||||
# create stacks
|
||||
#
|
||||
x, y = l.XM, self.height-l.YS
|
||||
x, y = l.XM, self.height - l.YS - l.TEXT_HEIGHT
|
||||
s.talon = DoubleFives_Talon(x, y, self, max_rounds=2, num_deal=1)
|
||||
l.createText(s.talon, "n")
|
||||
l.createRoundText(self.s.talon, 'nnn')
|
||||
l.createText(s.talon, "s")
|
||||
l.createRoundText(self.s.talon, 'n')
|
||||
x += l.XS
|
||||
for i in range(5):
|
||||
s.reserves.append(DoubleFives_WasteStack(x, y, self))
|
||||
x += l.XS
|
||||
l.createText(s.reserves[0], 'n')
|
||||
l.createText(s.reserves[0], 's')
|
||||
#
|
||||
x = self.width-l.XS
|
||||
s.addattr(stock=None) # register extra stack variable
|
||||
s.stock = DoubleFives_Stock(x, y, self)
|
||||
l.createText(s.stock, "n")
|
||||
l.createText(s.stock, "s")
|
||||
#
|
||||
x, y = l.XM, l.YM
|
||||
s.reserves.append(Glenwood_ReserveStack(x, y, self))
|
||||
|
|
|
@ -183,10 +183,10 @@ class Dial(Game):
|
|||
x, y = l.XM, l.YM
|
||||
s.talon = WasteTalonStack(x, y, self, max_rounds=2)
|
||||
l.createText(s.talon, 's')
|
||||
l.createRoundText(s.talon, 'sss')
|
||||
x += l.XS
|
||||
s.waste = WasteStack(x, y, self)
|
||||
l.createText(s.waste, 's')
|
||||
l.createRoundText(s.talon, 'ne', dx=l.XS)
|
||||
|
||||
l.defaultStackGroups()
|
||||
|
||||
|
@ -625,10 +625,10 @@ class Clock(Game):
|
|||
x, y = l.XM, l.YM
|
||||
s.talon = self.Talon_Class(x, y, self)
|
||||
l.createText(s.talon, 's')
|
||||
l.createRoundText(s.talon, 'sss')
|
||||
x += l.XS
|
||||
s.waste = WasteStack(x, y, self)
|
||||
l.createText(s.waste, 's')
|
||||
l.createRoundText(s.talon, 'ne', dx=l.XS)
|
||||
else:
|
||||
x, y = self.width - l.XS, self.height - l.YS
|
||||
s.talon = self.Talon_Class(x, y, self)
|
||||
|
|
|
@ -843,14 +843,14 @@ class LockedCards(Game):
|
|||
s.rows.append(self.RowStack_Class(x, y, self))
|
||||
x += l.XS
|
||||
|
||||
x, y = self.width-l.XS, self.height-l.YS
|
||||
x, y = self.width - l.XS, self.height - l.YS - l.TEXT_HEIGHT
|
||||
s.talon = WasteTalonStack(x, y, self, max_rounds=3)
|
||||
l.createText(s.talon, 'n')
|
||||
l.createRoundText(s.talon, 'nnn')
|
||||
l.createText(s.talon, 's')
|
||||
l.createRoundText(s.talon, 'n')
|
||||
|
||||
x -= l.XS
|
||||
s.waste = WasteStack(x, y, self)
|
||||
l.createText(s.waste, 'n')
|
||||
l.createText(s.waste, 's')
|
||||
|
||||
# define stack-groups
|
||||
l.defaultStackGroups()
|
||||
|
|
|
@ -75,9 +75,7 @@ class DoubleKlondike(Game):
|
|||
l.defaultAll()
|
||||
# extra
|
||||
if max_rounds > 1:
|
||||
anchor = 'nn'
|
||||
if layout.get("texts"):
|
||||
anchor = 'nnn'
|
||||
anchor = 'n'
|
||||
l.createRoundText(s.talon, anchor)
|
||||
return l
|
||||
|
||||
|
@ -248,15 +246,15 @@ class BigDeal(DoubleKlondike):
|
|||
SS_FoundationStack(x, y, self, suit=j % 4))
|
||||
y += l.YS
|
||||
x += l.XS
|
||||
x, y = l.XM, self.height-l.YS
|
||||
x, y = l.XM, self.height - l.YS - l.TEXT_HEIGHT
|
||||
s.talon = WasteTalonStack(x, y, self, max_rounds=max_rounds)
|
||||
l.createText(s.talon, 'n')
|
||||
l.createText(s.talon, 's')
|
||||
x += l.XS
|
||||
s.waste = WasteStack(x, y, self)
|
||||
s.waste.CARD_XOFFSET = XOFFSET
|
||||
l.createText(s.waste, 'n')
|
||||
l.createText(s.waste, 's')
|
||||
if max_rounds > 1:
|
||||
l.createRoundText(s.talon, 'nnn')
|
||||
l.createRoundText(s.talon, 'n')
|
||||
self.setRegion(s.rows, (-999, -999, l.XM+rows*l.XS-l.CW//2, 999999),
|
||||
priority=1)
|
||||
l.defaultStackGroups()
|
||||
|
|
|
@ -143,7 +143,7 @@ class OddAndEven(RoyalCotillion):
|
|||
l, s = Layout(self), self.s
|
||||
|
||||
# set window
|
||||
self.setSize(l.XM + 8*l.XS, l.YM + 4*l.YS)
|
||||
self.setSize(l.XM + 8 * l.XS, l.YM + l.TEXT_HEIGHT + 4 * l.YS)
|
||||
|
||||
# create stacks
|
||||
x, y, = l.XM, l.YM
|
||||
|
@ -161,13 +161,13 @@ class OddAndEven(RoyalCotillion):
|
|||
for j in range((4, 5)[i]):
|
||||
s.reserves.append(ReserveStack(x, y, self, max_accept=0))
|
||||
x += l.XS
|
||||
x, y = l.XM, self.height - l.YS
|
||||
x, y = l.XM, self.height - l.YS - l.TEXT_HEIGHT
|
||||
s.talon = WasteTalonStack(x, y, self, max_rounds=2)
|
||||
l.createText(s.talon, "n")
|
||||
l.createRoundText(s.talon, 'nnn')
|
||||
l.createText(s.talon, "s")
|
||||
l.createRoundText(s.talon, 'n')
|
||||
x += l.XS
|
||||
s.waste = WasteStack(x, y, self)
|
||||
l.createText(s.waste, "n")
|
||||
l.createText(s.waste, "s")
|
||||
|
||||
# define stack-groups
|
||||
l.defaultStackGroups()
|
||||
|
@ -332,7 +332,7 @@ class Alhambra(Game):
|
|||
l.createText(s.talon, 'n')
|
||||
anchor = 'nn'
|
||||
if rows > 1:
|
||||
anchor = 'nnn'
|
||||
anchor = 'sw'
|
||||
l.createRoundText(s.talon, anchor)
|
||||
|
||||
x += l.XS
|
||||
|
|
|
@ -65,7 +65,8 @@ class Sultan(Game):
|
|||
l, s = Layout(self), self.s
|
||||
|
||||
# set window
|
||||
w, h = 3*l.XM+5*l.XS, l.YM+4*l.YS+l.TEXT_HEIGHT+l.TEXT_MARGIN
|
||||
w, h = 3 * l.XM + 5 * l.XS, l.YM + 4 * l.YS + \
|
||||
(2 * l.TEXT_HEIGHT) + l.TEXT_MARGIN
|
||||
self.setSize(w, h)
|
||||
|
||||
# create stacks
|
||||
|
@ -96,10 +97,10 @@ class Sultan(Game):
|
|||
s.rows.append(ReserveStack(x, y, self))
|
||||
y += l.YS
|
||||
|
||||
x, y = 2*l.XM+1.5*l.XS, l.YM+3*l.YS
|
||||
x, y = 2*l.XM+1.5*l.XS, l.YM+3*l.YS + l.TEXT_HEIGHT
|
||||
s.talon = WasteTalonStack(x, y, self, max_rounds=3)
|
||||
l.createText(s.talon, "s")
|
||||
l.createRoundText(self.s.talon, 'sss')
|
||||
l.createRoundText(self.s.talon, 'n')
|
||||
x += l.XS
|
||||
s.waste = WasteStack(x, y, self)
|
||||
l.createText(s.waste, "s")
|
||||
|
@ -556,7 +557,7 @@ class PicturePatience(Game):
|
|||
l, s = Layout(self), self.s
|
||||
w, h = 3*l.XM+5*l.XS, l.YM+4*l.YS
|
||||
if max_rounds > 1:
|
||||
h += l.TEXT_HEIGHT+l.TEXT_MARGIN
|
||||
h += (2 * l.TEXT_HEIGHT) + l.TEXT_MARGIN
|
||||
self.setSize(w, h)
|
||||
|
||||
x, y = l.XM, l.YM
|
||||
|
@ -577,12 +578,14 @@ class PicturePatience(Game):
|
|||
x += l.XS
|
||||
y += l.YS
|
||||
x, y = 2*l.XM+l.XS+l.XS//2, l.YM+3*l.YS
|
||||
if max_rounds > 1:
|
||||
y += l.TEXT_HEIGHT
|
||||
s.talon = WasteTalonStack(x, y, self, max_rounds=max_rounds)
|
||||
x += l.XS
|
||||
s.waste = WasteStack(x, y, self)
|
||||
if max_rounds > 1:
|
||||
l.createText(s.talon, 's')
|
||||
l.createRoundText(s.talon, 'sss')
|
||||
l.createRoundText(s.talon, 'n')
|
||||
l.createText(s.waste, 's')
|
||||
else:
|
||||
l.createText(s.talon, 'sw')
|
||||
|
|
|
@ -170,14 +170,14 @@ class TwelveSleepingMaids(Game):
|
|||
s.rows.append(SS_RowStack(x, y, self))
|
||||
x += l.XS
|
||||
|
||||
x, y = self.width-l.XS, self.height-l.YS
|
||||
x, y = self.width - l.XS, self.height - l.YS - l.TEXT_HEIGHT
|
||||
s.talon = WasteTalonStack(x, y, self, max_rounds=3)
|
||||
l.createText(s.talon, 'n')
|
||||
l.createRoundText(s.talon, 'nnn')
|
||||
l.createText(s.talon, 's')
|
||||
l.createRoundText(s.talon, 'n')
|
||||
|
||||
x -= l.XS
|
||||
s.waste = WasteStack(x, y, self)
|
||||
l.createText(s.waste, 'n')
|
||||
l.createText(s.waste, 's')
|
||||
|
||||
# define stack-groups
|
||||
l.defaultStackGroups()
|
||||
|
|
|
@ -493,7 +493,7 @@ class Layout:
|
|||
w += XM
|
||||
|
||||
# set size so that at least 19 cards are fully playable
|
||||
h = YS + (playcards-1)*self.YOFFSET
|
||||
h = YS + self.TEXT_HEIGHT + (playcards-1)*self.YOFFSET
|
||||
h = max(h, 3*YS)
|
||||
if texts:
|
||||
h += self.TEXT_HEIGHT
|
||||
|
@ -521,7 +521,7 @@ class Layout:
|
|||
x += XS
|
||||
|
||||
# bottom
|
||||
x, y = XM, YM + h
|
||||
x, y = XM, YM + h - self.TEXT_HEIGHT
|
||||
for suit in range(suits):
|
||||
for i in range(decks):
|
||||
self.s.foundations.append(S(x, y, suit=suit))
|
||||
|
@ -537,13 +537,13 @@ class Layout:
|
|||
x = w - 2*XS
|
||||
self.s.waste = s = S(x, y)
|
||||
if texts:
|
||||
# place text above stack
|
||||
self._setText(s, 'n')
|
||||
# place text below stack
|
||||
self._setText(s, 's')
|
||||
x = w - XS
|
||||
self.s.talon = s = S(x, y)
|
||||
if texts:
|
||||
# place text above stack
|
||||
self._setText(s, 'n')
|
||||
# place text below stack
|
||||
self._setText(s, 's')
|
||||
|
||||
# set window
|
||||
self.size = (w, YM + h + YS)
|
||||
|
|
Loading…
Add table
Reference in a new issue