ui: Neusatz auf 8x10 — Elemente, docs/ui.md, Karten-Mocks

Alle UI-Elemente sind auf den 8x10-Satz umgesetzt und werden mit 2x
ausgeliefert (vorher 4x aus der 320x180-Basis). Neue Maße: Dialog
390x71 / 390x107 (47 Zeichen/Zeile), Buttons 64x18, Slots 26, Pack
170x132, Zauberbuch 170x140, Kampfleiste 400x56, Misc 220x130,
Ladebalken 240x26. Die alten Elemente und die Szenen-HUDs sind gelöscht.

docs/ui.md hält jetzt verbindlich fest: Screens (Karte, Kampf,
Inventar) mit Pixelmaßen, Schriftmetriken, Textmengen, Zustände,
Palette und die zwei Linien/Alpha-Regeln.

Neue Mocks über echten Karten: art/prep/map-mock/ (Stadt mit Dialog,
Dungeon, Inventar über abgedunkelter Karte) und der aktualisierte
Kampf-Mock (400x56-Leiste, 228x56-Log). Beide bei 1x und 2x.

Roadmap: 0.2 Layout/Font/Mocks/Textregeln abgehakt; offen sind 9-Slice,
Engine-Export der Schrift und Listen-Zustände. 0.4: systeme.md und ui.md
stehen, offen bleibt das Referenzblatt aus 0.1. Der Nachlauf auf 2x ist
für die UI erledigt, die übrigen Kategorien folgen.
This commit is contained in:
torsten 2026-11-14 23:45:29 +01:00
parent c0656a96e9
commit ee2c8b8efd
41 changed files with 639 additions and 317 deletions

View file

@ -1,18 +1,18 @@
#!/usr/bin/env python3
"""UI-Generator für Taloria — prozedural gezeichnet, 1x = 320x180-Maßstab.
"""UI-Generator für Taloria — prozedural gezeichnet, 1x = 640x360-Maßstab.
UI ist Linienarbeit: 1-px-Bevel, 2-px-Rahmen, harte Kanten. Ein
Diffusionsmodell liefert dort Farbverläufe und ausgefranste Kanten, die beim
Herunterrechnen wegbrechen. Deshalb wird hier gezeichnet, nicht generiert,
und zwar direkt bei 1x; ausgeliefert wird mit nearest 4x.
und zwar direkt bei 1x; ausgeliefert wird mit nearest 2x (1280x720).
python3 tools/ui.py # -> final/UI/, 4x (1280x720)
python3 tools/ui.py # -> final/UI/, 2x (1280x720)
python3 tools/ui.py --scale 1 # -> Basisgrößen, 1x
python3 tools/ui.py --out /tmp/ui # woanders hin
Die Dateinamen tragen die **Basisgröße** (z. B. ui_dialog_292x59.png =
292x59 bei 1x, 1168x236 in der Datei) — dieselbe Regel wie
monster_wolf_96px.png in final/Creatures/.
Schrift: 8x10 aus `font8.py` (Vorschub 8, Zeile 12). Die Dateinamen tragen
die **Basisgröße** (z. B. ui_dialog_390x66.png = 390x66 bei 1x, 780x132 in
der Datei) — dieselbe Regel wie monster_wolf_96px.png.
"""
from __future__ import annotations
@ -21,10 +21,10 @@ from pathlib import Path
from PIL import Image, ImageDraw
import font8 # noqa: E402 (gleicher Ordner)
ART = Path(__file__).resolve().parent.parent
FINAL = ART / "final"
SCENE_B = FINAL / "Pictures" / "taverne_B_1280x720.png"
SCENE_A = FINAL / "Pictures" / "taverne_A_1280x720.png"
SWORD = FINAL / "Objects" / "objekt_schwert_32px.png"
# ---------------------------------------------------------------- Palette (16)
@ -47,56 +47,6 @@ BLOOD = (150, 58, 46, 255)
PALETTE = [INK, PANEL, PANEL_HI, PANEL_LO, LINE, CREAM, CREAM_D, OCHRE,
OCHRE_D, GOLD, SLATE, SLATE_D, OLIVE, OLIVE_D, BLOOD]
# -------------------------------------------------------------- Font 5x7
FONT = {
"A": ".###.|#...#|#...#|#####|#...#|#...#|#...#",
"B": "####.|#...#|#...#|####.|#...#|#...#|####.",
"C": ".####|#....|#....|#....|#....|#....|.####",
"D": "####.|#...#|#...#|#...#|#...#|#...#|####.",
"E": "#####|#....|#....|####.|#....|#....|#####",
"F": "#####|#....|#....|####.|#....|#....|#....",
"G": ".####|#....|#....|#..##|#...#|#...#|.###.",
"H": "#...#|#...#|#...#|#####|#...#|#...#|#...#",
"I": "#####|..#..|..#..|..#..|..#..|..#..|#####",
"J": "..###|...#.|...#.|...#.|...#.|#..#.|.##..",
"K": "#...#|#..#.|#.#..|##...|#.#..|#..#.|#...#",
"L": "#....|#....|#....|#....|#....|#....|#####",
"M": "#...#|##.##|#.#.#|#.#.#|#...#|#...#|#...#",
"N": "#...#|##..#|#.#.#|#.#.#|#..##|#...#|#...#",
"O": ".###.|#...#|#...#|#...#|#...#|#...#|.###.",
"P": "####.|#...#|#...#|####.|#....|#....|#....",
"Q": ".###.|#...#|#...#|#...#|#.#.#|#..#.|.##.#",
"R": "####.|#...#|#...#|####.|#.#..|#..#.|#...#",
"S": ".####|#....|#....|.###.|....#|....#|####.",
"T": "#####|..#..|..#..|..#..|..#..|..#..|..#..",
"U": "#...#|#...#|#...#|#...#|#...#|#...#|.###.",
"V": "#...#|#...#|#...#|#...#|#...#|.#.#.|..#..",
"W": "#...#|#...#|#...#|#.#.#|#.#.#|##.##|#...#",
"X": "#...#|#...#|.#.#.|..#..|.#.#.|#...#|#...#",
"Y": "#...#|#...#|.#.#.|..#..|..#..|..#..|..#..",
"Z": "#####|....#|...#.|..#..|.#...|#....|#####",
"0": ".###.|#...#|#..##|#.#.#|##..#|#...#|.###.",
"1": "..#..|.##..|..#..|..#..|..#..|..#..|.###.",
"2": ".###.|#...#|....#|...#.|..#..|.#...|#####",
"3": "####.|....#|....#|.###.|....#|....#|####.",
"4": "...#.|..##.|.#.#.|#..#.|#####|...#.|...#.",
"5": "#####|#....|####.|....#|....#|#...#|.###.",
"6": "..##.|.#...|#....|####.|#...#|#...#|.###.",
"7": "#####|....#|...#.|..#..|.#...|.#...|.#...",
"8": ".###.|#...#|#...#|.###.|#...#|#...#|.###.",
"9": ".###.|#...#|#...#|.####|....#|...#.|.##..",
".": ".....|.....|.....|.....|.....|.##..|.##..",
",": ".....|.....|.....|.....|.##..|.##..|.#...",
"/": "....#|....#|...#.|..#..|.#...|#....|#....",
":": ".....|.##..|.##..|.....|.##..|.##..|.....",
"-": ".....|.....|.....|#####|.....|.....|.....",
"!": "..#..|..#..|..#..|..#..|..#..|.....|..#..",
"?": ".###.|#...#|....#|...#.|..#..|.....|..#..",
"+": ".....|..#..|..#..|#####|..#..|..#..|.....",
"'": "..#..|..#..|.....|.....|.....|.....|.....",
}
def alpha(c, a: int = 255):
return (c[0], c[1], c[2], a)
@ -112,20 +62,12 @@ def lighter(c, f: float = 1.12):
# ---------------------------------------------------------------- Schrift ----
def draw_text(d: ImageDraw.ImageDraw, x: int, y: int, text: str,
color=CREAM) -> int:
"""5x7-Pixelfont, 1 px Laufweite → 6 px Vorschub."""
for ch in text.upper():
glyph = FONT.get(ch)
if glyph:
for row, bits in enumerate(glyph.split("|")):
for col, bit in enumerate(bits):
if bit == "#":
d.point((x + col, y + row), fill=color)
x += 6
return x
"""8x10-Pixelfont aus font8.py, Vorschub 8, Zeile 12."""
return font8.draw_text(d, x, y, text, color)
def text_width(text: str) -> int:
return max(0, len(text) * 6 - 1)
return font8.text_width(text)
# ---------------------------------------------------------------- Bausteine --
@ -168,12 +110,16 @@ def title_bar(d, box, label):
x0, y0, x1, y1 = box
d.rectangle((x0, y0, x1, y1), fill=OCHRE_D)
d.line((x0, y1, x1, y1), fill=INK)
draw_text(d, x0 + 5, y0 + 3, label, CREAM)
draw_text(d, x0 + 5, y0 + 4, label, CREAM)
# ------------------------------------------------------------------ Elemente
def elem_dialog(lines, name, height, w=292) -> Image.Image:
"""Textbox mit Namensschild; height = Panelhöhe bei 1x, w = Breite bei 1x."""
def elem_dialog(lines, name, height, w=390) -> Image.Image:
"""Textbox mit Namensschild; height = Panelhöhe bei 1x, w = Breite bei 1x.
Achtung: `height` ist die Panelhöhe ohne das Namensschild (5 px Überstand
oben). Drei Zeilen brauchen 66, sechs Zeilen 102.
"""
im = Image.new("RGBA", (w, height + 5), (0, 0, 0, 0))
d = ImageDraw.Draw(im)
@ -182,14 +128,14 @@ def elem_dialog(lines, name, height, w=292) -> Image.Image:
d.rectangle((1, 6, w - 2, height + 3), outline=LINE)
d.line((2, 6, w - 3, 6), fill=PANEL_LO)
tw = text_width(name) + 10
d.rectangle((6, 0, 6 + tw, 13), fill=OCHRE_D)
d.rectangle((6, 0, 6 + tw, 13), outline=INK)
tw = text_width(name) + 12
d.rectangle((6, 0, 6 + tw, 17), fill=OCHRE_D)
d.rectangle((6, 0, 6 + tw, 17), outline=INK)
d.line((7, 1, 5 + tw, 1), fill=OCHRE)
draw_text(d, 11, 3, name, CREAM)
draw_text(d, 11, 4, name, CREAM)
for i, line in enumerate(lines):
draw_text(d, 11, 21 + i * 10, line,
draw_text(d, 11, 24 + i * 12, line,
CREAM if i < len(lines) - 1 else CREAM_D)
ax, ay = w - 13, height + 1
@ -200,7 +146,7 @@ def elem_dialog(lines, name, height, w=292) -> Image.Image:
def elem_buttons() -> Image.Image:
labels = ["ATTACK", "TALK", "USE", "FLEE"]
bw, bh, gap = 52, 14, 4
bw, bh, gap = 64, 18, 6
im = Image.new("RGBA", (bw, (bh + gap) * 4 + 4), (0, 0, 0, 0))
d = ImageDraw.Draw(im)
for i, (label, state) in enumerate(zip(labels, ["idle", "hover",
@ -224,29 +170,29 @@ def elem_buttons() -> Image.Image:
def icon_sword() -> Image.Image:
return Image.open(SWORD).convert("RGBA").resize((18, 18), Image.NEAREST)
return Image.open(SWORD).convert("RGBA").resize((20, 20), Image.NEAREST)
def icon_herb() -> Image.Image:
im = Image.new("RGBA", (18, 18), (0, 0, 0, 0))
im = Image.new("RGBA", (20, 20), (0, 0, 0, 0))
d = ImageDraw.Draw(im)
d.polygon([(9, 1), (12, 7), (9, 16), (6, 7)], fill=OLIVE)
d.line((9, 3, 9, 14), fill=OLIVE_D)
d.line((7, 8, 4, 12), fill=OLIVE_D)
d.line((11, 8, 14, 12), fill=OLIVE_D)
d.polygon([(10, 1), (13, 8), (10, 18), (7, 8)], fill=OLIVE)
d.line((10, 3, 10, 16), fill=OLIVE_D)
d.line((8, 9, 4, 13), fill=OLIVE_D)
d.line((12, 9, 16, 13), fill=OLIVE_D)
return im
def icon_coin() -> Image.Image:
im = Image.new("RGBA", (18, 18), (0, 0, 0, 0))
im = Image.new("RGBA", (20, 20), (0, 0, 0, 0))
d = ImageDraw.Draw(im)
d.ellipse((3, 5, 14, 16), fill=OCHRE)
d.ellipse((4, 6, 13, 15), outline=GOLD)
d.ellipse((3, 6, 16, 18), fill=OCHRE)
d.ellipse((4, 7, 15, 17), outline=GOLD)
return im
def elem_slots() -> Image.Image:
s, gap = 22, 3
s, gap = 26, 4
im = Image.new("RGBA", (s * 6 + gap * 5, s + 6), (0, 0, 0, 0))
d = ImageDraw.Draw(im)
for i, sprite in enumerate([None, icon_sword(), icon_herb(), None,
@ -254,16 +200,16 @@ def elem_slots() -> Image.Image:
x = i * (s + gap)
well(d, (x, 3, x + s - 1, 3 + s - 1))
if sprite is not None:
im.alpha_composite(sprite, (x + 2, 5))
im.alpha_composite(sprite, (x + 3, 6))
if i == 4: # Auswahl: 2-px-Rahmen + Stapelzahl
d.rectangle((x, 3, x + s - 1, 3 + s - 1), outline=GOLD)
d.rectangle((x + 1, 4, x + s - 2, 2 + s), outline=GOLD)
d.rectangle((x + 7, 13, x + s - 2, 3 + s - 2), fill=INK)
draw_text(d, x + 8, 15, "12", GOLD)
d.rectangle((x + 8, 16, x + 24, 27), fill=INK)
draw_text(d, x + 9, 17, "12", GOLD)
if i == 5: # gesperrt: Schraffur, auf die Slot-Fläche beschnitten
hatch = Image.new("RGBA", (s, s), (0, 0, 0, 0))
hd2 = ImageDraw.Draw(hatch)
for k in range(-s, s, 5):
for k in range(-s, s, 6):
hd2.line((k, s - 1, k + s - 1, 0), fill=(54, 46, 38, 255))
im.alpha_composite(hatch, (x, 3))
d.line((x, 3, x + s - 1, 3), fill=INK)
@ -274,27 +220,27 @@ def elem_slots() -> Image.Image:
def elem_pack() -> Image.Image:
w, h = 148, 112
w, h = 170, 132
im = Image.new("RGBA", (w, h), (0, 0, 0, 0))
d = ImageDraw.Draw(im)
panel(d, (0, 0, w - 1, h - 1), line=INK)
d.rectangle((1, 1, w - 2, h - 2), outline=LINE)
title_bar(d, (2, 2, w - 3, 14), "PACK")
title_bar(d, (2, 2, w - 3, 18), "PACK")
d.rectangle((w - 15, 4, w - 5, 12), fill=PANEL_LO)
d.rectangle((w - 15, 4, w - 5, 12), outline=LINE)
d.line((w - 12, 6, w - 8, 10), fill=CREAM_D)
d.line((w - 8, 6, w - 12, 10), fill=CREAM_D)
d.rectangle((w - 17, 5, w - 5, 15), fill=PANEL_LO)
d.rectangle((w - 17, 5, w - 5, 15), outline=LINE)
d.line((w - 13, 7, w - 9, 11), fill=CREAM_D)
d.line((w - 9, 7, w - 13, 11), fill=CREAM_D)
s, gap, ox, oy = 22, 4, 6, 19
s, gap, ox, oy = 26, 4, 8, 24
for row in range(3):
for col in range(5):
x = ox + col * (s + gap)
y = oy + row * (s + gap)
well(d, (x, y, x + s - 1, y + s - 1))
draw_text(d, 7, h - 11, "LOAD 42/60", CREAM_D)
draw_text(d, w - 7 - text_width("128 GOLD"), h - 11, "128 GOLD", GOLD)
draw_text(d, 8, h - 14, "LOAD 42/60", CREAM_D)
draw_text(d, w - 8 - text_width("128 GOLD"), h - 14, "128 GOLD", GOLD)
return im
@ -333,39 +279,39 @@ def rune(kind: str) -> Image.Image:
def elem_spells() -> Image.Image:
w, h = 148, 116
w, h = 170, 140
im = Image.new("RGBA", (w, h), (0, 0, 0, 0))
d = ImageDraw.Draw(im)
panel(d, (0, 0, w - 1, h - 1), line=INK)
d.rectangle((1, 1, w - 2, h - 2), outline=LINE)
title_bar(d, (2, 2, w - 3, 14), "SPELLBOOK")
title_bar(d, (2, 2, w - 3, 18), "SPELLBOOK")
# Schulen-Tabs, der erste aktiv
for i, (label, active) in enumerate([("ARCANE", True), ("DIVINE", False)]):
x = 6 + i * 46
panel(d, (x, 17, x + 43, 29), fill=OCHRE_D if active else PANEL_LO,
x = 6 + i * 62
panel(d, (x, 22, x + 57, 38), fill=OCHRE_D if active else PANEL_LO,
line=GOLD if active else LINE, bevel=not active)
draw_text(d, x + 5, 21, label, CREAM if active else CREAM_D)
draw_text(d, x + 5, 26, label, CREAM if active else CREAM_D)
spells = [("fire", 3), ("ice", 2), ("bolt", 2), ("ward", 1), ("eye", 4),
("leaf", 1), ("star", 3), (None, 0), (None, 0), (None, 0),
(None, 0), (None, 0), (None, 0), (None, 0), (None, 0)]
s, gap, ox, oy = 20, 4, 16, 33
s, gap, ox, oy = 20, 4, 16, 44
for idx, (kind, cost) in enumerate(spells):
col, row = idx % 5, idx // 5
x = ox + col * (s + gap)
y = oy + row * (s + gap)
well(d, (x, y, x + s - 1, y + s - 1))
if kind:
im.alpha_composite(rune(kind), (x + 3, y + 2))
d.rectangle((x + s - 8, y + s - 8, x + s - 2, y + s - 2), fill=INK)
draw_text(d, x + s - 7, y + s - 7, str(cost), GOLD)
im.alpha_composite(rune(kind), (x + 3, y + 3))
d.rectangle((x + 11, y + 10, x + 19, y + 19), fill=INK)
draw_text(d, x + 12, y + 10, str(cost), GOLD)
if idx == 0: # gewählter Zauber
d.rectangle((x, y, x + s - 1, y + s - 1), outline=GOLD)
d.rectangle((x + 1, y + 1, x + s - 2, y + s - 2), outline=GOLD)
draw_text(d, 7, h - 11, "MEM 3/6 SLOTS", CREAM_D)
draw_text(d, w - 7 - text_width("LVL 4"), h - 11, "LVL 4", GOLD)
draw_text(d, 8, h - 14, "MEM 3/6 SLOTS", CREAM_D)
draw_text(d, w - 8 - text_width("LVL 4"), h - 14, "LVL 4", GOLD)
return im
@ -438,30 +384,31 @@ def bust(d, x, y, hood, trim, skin):
def elem_misc() -> Image.Image:
im = Image.new("RGBA", (170, 104), (0, 0, 0, 0))
im = Image.new("RGBA", (220, 130), (0, 0, 0, 0))
d = ImageDraw.Draw(im)
bar(d, 0, 0, 52, 10, "HP", 24, 30, BLOOD)
bar(d, 0, 12, 52, 10, "SP", 11, 20, OLIVE)
bar(d, 0, 24, 52, 10, "MP", 3, 15, SLATE)
bar(d, 0, 0, 120, 12, "HP", 24, 30, BLOOD)
bar(d, 0, 16, 120, 12, "SP", 11, 20, OLIVE)
bar(d, 0, 32, 120, 12, "MP", 3, 15, SLATE)
for i, on in enumerate([False, True]):
x = 112 + i * 16
well(d, (x, 2, x + 11, 13))
x = 188 + i * 18
well(d, (x, 2, x + 13, 15))
if on:
d.line((x + 2, 7, x + 4, 10), fill=GOLD)
d.line((x + 4, 10, x + 9, 4), fill=GOLD)
d.line((x + 3, 8, x + 6, 12), fill=GOLD)
d.line((x + 6, 12, x + 10, 4), fill=GOLD)
sx, sy = 0, 57
draw_text(d, sx, 46, "VOLUME", CREAM_D)
well(d, (sx, sy, sx + 64, sy + 5))
d.rectangle((sx + 1, sy + 1, sx + 34, sy + 4), fill=OCHRE_D)
panel(d, (sx + 31, sy - 4, sx + 39, sy + 8), bevel=False)
sx, sy = 0, 70
draw_text(d, sx, 52, "VOLUME", CREAM_D)
well(d, (sx, sy, sx + 100, sy + 7))
d.rectangle((sx + 2, sy + 2, sx + 54, sy + 5), fill=OCHRE_D)
panel(d, (sx + 51, sy - 4, sx + 59, sy + 11), bevel=False)
panel(d, (88, 40, 168, 65), fill=alpha((30, 25, 21, 255), 246), line=INK)
draw_text(d, 93, 44, "RUSTY SWORD", CREAM)
draw_text(d, 93, 54, "1D6+1 SLASH", CREAM_D)
panel(d, (110, 50, 218, 86), fill=alpha((30, 25, 21, 255), 246), line=INK)
draw_text(d, 116, 54, "RUSTY SWORD", CREAM)
draw_text(d, 116, 66, "1D6+1 SLASH", CREAM_D)
draw_text(d, 116, 78, "10 GOLD", GOLD)
cx, cy = 112, 76
cx, cy = 180, 98
d.polygon([(cx, cy), (cx + 11, cy + 4), (cx + 5, cy + 6),
(cx + 8, cy + 12), (cx + 5, cy + 13), (cx + 3, cy + 7),
(cx, cy + 7)], fill=CREAM, outline=INK)
@ -470,75 +417,50 @@ def elem_misc() -> Image.Image:
def elem_combat() -> Image.Image:
"""Kampf-Aktionsleiste: Initiative-Reihe oben, Aktionen unten."""
w, h = 300, 40
w, h = 400, 56
im = Image.new("RGBA", (w, h), (0, 0, 0, 0))
d = ImageDraw.Draw(im)
# Initiative: Chips, der aktive in GOLD, Gegner in BLOOD
for i in range(8):
x = 6 + i * 12
x = 6 + i * 14
chip = [(SLATE, None), (SLATE, None), (BLOOD, None), (GOLD, INK),
(SLATE, None), (BLOOD, None), (SLATE, None), (BLOOD, None)][i]
d.rectangle((x, 1, x + 8, 9), fill=chip[0])
d.rectangle((x, 1, x + 8, 9), outline=INK if chip[1] is None else GOLD)
draw_text(d, 110, 2, "RND 3", CREAM_D)
d.rectangle((x, 2, x + 9, 11), fill=chip[0])
d.rectangle((x, 2, x + 9, 11), outline=INK if chip[1] is None else GOLD)
draw_text(d, 134, 2, "RND 3", CREAM_D)
panel(d, (0, 13, w - 1, h - 1), fill=alpha(PANEL, 236), line=INK)
labels = ["ATTACK", "MOVE", "SPELL", "ITEM", "DEFEND"]
for i, label in enumerate(labels):
x = 6 + i * 47
panel(d, (x, 19, x + 42, 34), fill=OCHRE_D if label == "SPELL" else PANEL,
panel(d, (0, 17, w - 1, h - 1), fill=alpha(PANEL, 236), line=INK)
labels = ["ATTACK", "MOVE", "SPELL", "ITEM", "DEFEND", "END TURN"]
x = 6
for label in labels:
bw = text_width(label) + 14
panel(d, (x, 23, x + bw - 1, 49),
fill=OCHRE_D if label == "SPELL" else PANEL,
line=GOLD if label == "SPELL" else LINE)
tw = text_width(label)
draw_text(d, x + (43 - tw) // 2, 23, label,
draw_text(d, x + 7, 31, label,
CREAM if label == "SPELL" else CREAM_D)
panel(d, (241, 19, 293, 34), fill=PANEL, line=LINE)
draw_text(d, 241 + (53 - text_width("END TURN")) // 2, 23, "END TURN", CREAM)
x += bw + 4
return im
def elem_loadbar() -> Image.Image:
w, h = 180, 20
w, h = 240, 26
im = Image.new("RGBA", (w, h), (0, 0, 0, 0))
d = ImageDraw.Draw(im)
draw_text(d, 0, 0, "LOADING THE HARBOUR", CREAM_D)
draw_text(d, w - text_width("62%"), 0, "62%", CREAM_D)
well(d, (0, 9, w - 1, h - 1))
draw_text(d, w - text_width("62%") - 1, 0, "62%", CREAM_D)
well(d, (0, 14, w - 1, h - 1))
fillw = round((w - 4) * 0.62)
d.rectangle((2, 11, 1 + fillw, h - 2), fill=OCHRE_D)
d.line((2, 11, 1 + fillw, 11), fill=OCHRE)
d.rectangle((2, 16, 1 + fillw, h - 2), fill=OCHRE_D)
d.line((2, 16, 1 + fillw, 16), fill=OCHRE)
# Segmentmarken alle 10 %
for k in range(1, 10):
x = 2 + round((w - 4) * k / 10)
d.line((x, 11, x, h - 2), fill=alpha(INK, 150))
d.line((x, 16, x, h - 2), fill=alpha(INK, 150))
return im
# ------------------------------------------------------------------ Mocks ---
def mock_hud(scene: Path) -> Image.Image:
"""Szene als Hintergrund, UI darüber — die Lesbarkeitsprobe bei 1x."""
base = Image.open(scene).convert("RGBA").resize((320, 180), Image.LANCZOS)
d = ImageDraw.Draw(base)
base.alpha_composite(elem_party(count=3, fw=34, fh=34, psize=26),
(320 - 34 - 6, 6))
panel(d, (6, 6, 46, 20), fill=alpha(PANEL, 232))
draw_text(d, 11, 10, "MENU", CREAM)
d.rectangle((153, 6, 166, 20), fill=alpha(PANEL, 232))
d.rectangle((153, 6, 166, 20), outline=LINE)
draw_text(d, 156, 10, "N", GOLD)
base.alpha_composite(
elem_dialog(["THE HARBOUR IS QUIET TONIGHT. TOO QUIET",
"FOR A TOWN THAT SMELLS OF SALT AND IRON.",
"WHAT DO YOU WANT TO DO?"], "ALDRIC THE GREY", 54),
(14, 116))
d.rectangle((0, 0, 319, 179), outline=INK)
return base
def palette_anchor() -> Image.Image:
"""Palette-Anker für `pixelize.py --palette` (16 Farben, 4x4-Raster)."""
im = Image.new("RGB", (32, 32), INK[:3])
@ -564,37 +486,35 @@ def main(argv=None) -> None:
ap = argparse.ArgumentParser(description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter)
ap.add_argument("--out", type=Path, default=FINAL / "UI")
ap.add_argument("--scale", type=int, default=4,
help="1 = Basisgröße, 4 = Auslieferung (Default)")
ap.add_argument("--scale", type=int, default=2,
help="1 = Basisgröße, 2 = Auslieferung (Default)")
a = ap.parse_args(argv)
elements = {
"ui_dialog_292x59": elem_dialog(
"ui_dialog_390x71": elem_dialog(
["THE HARBOUR IS QUIET TONIGHT. TOO QUIET",
"FOR A TOWN THAT SMELLS OF SALT AND IRON.",
"WHAT DO YOU WANT TO DO?"], "ALDRIC THE GREY", 54),
"ui_dialog_gross_292x89": elem_dialog(
"WHAT DO YOU WANT TO DO?"], "ALDRIC THE GREY", 66),
"ui_dialog_gross_390x107": elem_dialog(
["THE HARBOUR IS QUIET TONIGHT. TOO QUIET FOR",
"A TOWN THAT SMELLS OF SALT AND IRON. THE",
"LANTERNS SWING, THE GULLS HAVE GONE TO",
"ROOST, AND THE TIDE IS COMING IN UNDER",
"THE PIER. SOMETHING IS WRONG WITH THE",
"WATER, AND NOBODY WILL SAY WHAT."],
"ALDRIC THE GREY", 84),
"ui_buttons_52x14": elem_buttons(),
"ui_slots_22px": elem_slots(),
"ui_window_pack_148x112": elem_pack(),
"ui_window_zauber_148x116": elem_spells(),
"ALDRIC THE GREY", 102),
"ui_buttons_64x18": elem_buttons(),
"ui_slots_26px": elem_slots(),
"ui_window_pack_170x132": elem_pack(),
"ui_window_zauber_170x140": elem_spells(),
"ui_party_40px": elem_party(party_portraits()),
"ui_misc_170x104": elem_misc(),
"ui_kampf_leiste_300x40": elem_combat(),
"ui_ladebalken_180x20": elem_loadbar(),
"ui_misc_220x130": elem_misc(),
"ui_kampf_leiste_400x56": elem_combat(),
"ui_ladebalken_240x26": elem_loadbar(),
}
for name, im in elements.items():
save(im, a.out, name, a.scale)
save(mock_hud(SCENE_B), a.out, "_mock_hud_B_1280x720", a.scale)
save(mock_hud(SCENE_A), a.out, "_mock_hud_A_1280x720", a.scale)
save(palette_anchor(), a.out, "_palette_ui", 1)