Skip to content

Commit

Permalink
[WIP] insert numbers in crazyhouse sprites lichess-org#13
Browse files Browse the repository at this point in the history
  • Loading branch information
ryg-git committed Jan 12, 2025
1 parent 9b43334 commit 1e285ca
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions theme/ch.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,18 @@ def make_ch_sprite(pieces, ch_nums):
bpos = ((4 + i) * SQUARE_SIZE, y * SQUARE_SIZE)
bpiece = pieces[f"b{piece}"]
image.paste(bpiece, bpos, bpiece)

if y > 0:
ch = ch_nums[f"{y + 1}"]
image.paste(ch, (wpos[0] + 55, wpos[1] + 55))
image.paste(ch, (bpos[0] + 55, bpos[1] + 55))

# for y in range(1, 5):
# for x in range(8):
# pos = (x * SQUARE_SIZE + 5, y * SQUARE_SIZE + 5)
# num = ch_nums[x + 1]
# image.paste(num, pos, num)

wpos = (i * SQUARE_SIZE, y * SQUARE_SIZE)
wpiece = pieces[f"w{piece}"]
image.paste(wpiece, wpos, wpiece)

for x in range(4):
pos = (x * SQUARE_SIZE, 5 * SQUARE_SIZE)
piece = pieces["wP"]
Expand All @@ -43,6 +44,10 @@ def make_ch_sprite(pieces, ch_nums):
pos = (x * SQUARE_SIZE, 5 * SQUARE_SIZE)
piece = pieces["bP"]
image.paste(piece, pos, piece)

for y in range(5, 7):
for x in range(8):
pass

for x in range(8):
wpos = (x * SQUARE_SIZE, 6 * SQUARE_SIZE)
Expand All @@ -52,6 +57,12 @@ def make_ch_sprite(pieces, ch_nums):
bpos = (x * SQUARE_SIZE, 7 * SQUARE_SIZE)
bpiece = pieces[f"bP"]
image.paste(bpiece, bpos, bpiece)

ch = ch_nums[f"{x + 1}"]
wchp = (x * SQUARE_SIZE + 55, 6 * SQUARE_SIZE + 55)
image.paste(ch, wchp)
bchp = (x * SQUARE_SIZE + 55, 7 * SQUARE_SIZE + 55)
image.paste(ch, bchp)

draw.rectangle((0, 0, 8 * SQUARE_SIZE, SQUARE_SIZE),
fill="#262421AA")
Expand Down

0 comments on commit 1e285ca

Please sign in to comment.