- Splash: Summit's icon rises in over an amber glow, the name follows, then it fades into the app (about a second, no keys taken, off when motion is off) - install.sh: after installing icons, rebuild KDE's sycoca and send KIconLoader.iconChanged so a running Plasma shows the updated icon - New app icon (SVG + rendered PNG sizes, render.sh), used by the packages and the engine's window - Lutris scan, consoles (Remote Play via chiaki-ng frame tap, capture cards), Steam account switching, running-game tracking, window mode, artwork - Library UI: add dialog, profile editor, accounts, "now playing" screen - Engine: in-game overlay/HUD, overlay key, global key fixes Co-Authored-By: Claude Opus 5.5 <[email protected]>
46 lines
2.0 KiB
Python
46 lines
2.0 KiB
Python
"""The Summit watermark: one small line of text in a corner of the video window (settings "watermark", on by default).
|
|
Pure drawing (framegen/ui_draw.py), so it is tested without a window."""
|
|
from __future__ import annotations
|
|
|
|
import numpy as np
|
|
|
|
from . import ui_draw as U
|
|
|
|
TEXT = "summit - git.molberg.cloud/alex/summit"
|
|
BG = (24, 22, 20) # the box behind the text (BGR); drawn see-through by the window
|
|
FG = (235, 235, 235)
|
|
OPACITY = 0.45 # of the box; the text stays solid
|
|
CORNERS = ("top-left", "top-right", "bottom-left", "bottom-right")
|
|
|
|
|
|
def corner(stats_corner: str, stats_on: bool = True) -> str:
|
|
"""Where it goes: bottom-left, or bottom-right when the stats overlay sits bottom-left (never on top of it;
|
|
messages appear bottom-right, briefly)."""
|
|
return "bottom-right" if stats_on and stats_corner == "bottom-left" else "bottom-left"
|
|
|
|
|
|
def _canvas(ui: float, text: str) -> U.Canvas:
|
|
f = U.font(max(9, round(12 * max(ui, 0.6))))
|
|
padx, pady = max(4, int(8 * ui)), max(3, int(5 * ui))
|
|
asc, desc = f.getmetrics()
|
|
c = U.Canvas(U.text_w(text, f) + 2 * padx, asc + desc + 2 * pady, BG[::-1], radius=max(3, int(6 * ui)))
|
|
c.text(padx, pady + asc, text, f, FG[::-1], "ls")
|
|
return c
|
|
|
|
|
|
def render(ui: float = 1.0, text: str = TEXT) -> np.ndarray:
|
|
"""The watermark as a small BGR image; ui scales it with the picture (1.0 at 1080p)."""
|
|
return np.ascontiguousarray(_canvas(ui, text).rgb()[..., ::-1])
|
|
|
|
|
|
def render_rgba(ui: float = 1.0, text: str = TEXT) -> np.ndarray:
|
|
"""The same as RGBA, for the window: rounded corners, and the box lets the game show through."""
|
|
return _canvas(ui, text).rgba(OPACITY)
|
|
|
|
|
|
def place(corner_: str, pw: int, ph: int, x0: int, y0: int, dw: int, dh: int, margin: int) -> tuple[int, int]:
|
|
"""(x, GL y of the top edge) for a pw x ph panel in a corner of the picture at (x0, y0, dw, dh); GL y grows up."""
|
|
x = x0 + dw - pw - margin if corner_.endswith("right") else x0 + margin
|
|
top = y0 + margin + ph if corner_.startswith("bottom") else y0 + dh - margin
|
|
return x, top
|