# Title-screen layout mockups (option 1): logo rows 2-10, title text row 11, # score table moved down. Writes .cells files for galaga-mosaic-show. import sys SOLID, DASH = 0x25, 0x26 YELLOW, ORANGE, GREEN, CYAN, RED = 5, 6, 8, 0, 4 def text_cells(row, text, colour, centre=True, col=None): out = [] c0 = (28 - len(text)) // 2 if centre else col for i, ch in enumerate(text): if ch == ' ': continue if ch == ']': code = DASH else: code = ord(ch) - 0x30 if code >= 0x11: code -= 7 out.append((row, c0 + i, code, colour)) return out FONT = { 'G': [".###", "#...", "#...", "#.##", "#..#", "#..#", ".###"], 'A': [".##.", "#..#", "#..#", "####", "#..#", "#..#", "#..#"], 'L': ["#..", "#..", "#..", "#..", "#..", "#..", "###"], } def my_logo(top): # Block letters 7 tall, yellow fading to orange, a green field below. out = [] col = 0 fade = [YELLOW, YELLOW, YELLOW, ORANGE, ORANGE, RED, RED] for ch in "GALAGA": g = FONT[ch] for y, line in enumerate(g): for x, b in enumerate(line): if b == '#': out.append((top + y, col + x, SOLID, fade[y])) col += len(g[0]) + 1 out += [(top + 8, c, DASH, GREEN) for c in range(28)] return out def table(top): return (text_cells(top, "]] SCORE ]]", CYAN) + text_cells(top + 2, "50 100", CYAN, centre=False, col=8) + text_cells(top + 4, "80 160", CYAN, centre=False, col=8)) title = text_cells(11, "JOHN DEERE TRACTOR BEAM", YELLOW) which = sys.argv[1] cells = my_logo(2) if which == "mine" else [tuple(map(int, l.split())) for l in open(sys.argv[2])] cells += title + table(13) with open(f"target/mosaic/layout/{which}.cells", "w") as f: for r, c, code, colour in cells: f.write(f"{r} {c} {code} {colour}\n") print(which, len(cells), "cells")