Pointer in the editor; new screenshots and an editor section in the README
Scenes for the screenshots come from export_scenes (src/scenes.rs) and are taken with tools/screenshots.py in the Playwright image. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f3ee6296db
commit
ef7add2846
16 files changed
+257
-2
No files matched your search
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Screenshots for docs/screenshots.
|
||||
|
||||
1. `cargo test --release export_scenes -- --ignored` writes the scene savegames to /tmp/scenes.
|
||||
2. Build the WASM file and serve www/ with it and mq_js_bundle.js on http://127.0.0.1:18190/
|
||||
(no savegame service, so no login).
|
||||
3. Copy /tmp/scenes/*.json next to this script into a folder mounted as /shots and run it in the
|
||||
Playwright image with host networking, e.g.
|
||||
docker run --rm --network host -v /tmp/shots:/shots mcr.microsoft.com/playwright/python:v1.62.0-noble \
|
||||
bash -c "pip install playwright==1.62.0 --break-system-packages; python3 /shots/screenshots.py"
|
||||
The pictures land in /shots/out (1280x800, English).
|
||||
"""
|
||||
import json, glob, os
|
||||
from playwright.sync_api import sync_playwright
|
||||
URL = 'http://127.0.0.1:18190/'
|
||||
ARGS = ['--use-gl=angle', '--use-angle=swiftshader', '--enable-unsafe-swiftshader', '--ignore-gpu-blocklist']
|
||||
def page_with(p, store):
|
||||
b = p.chromium.launch(args=ARGS)
|
||||
page = b.new_page(viewport={'width': 1280, 'height': 800})
|
||||
page.goto(URL)
|
||||
page.evaluate("(s) => { for (const k in s) localStorage.setItem(k, s[k]); }", store)
|
||||
page.reload()
|
||||
page.wait_for_timeout(13000)
|
||||
return b, page
|
||||
def steps(page, st):
|
||||
for s in st:
|
||||
if 'click' in s: page.mouse.click(*s['click'])
|
||||
if 'move' in s: page.mouse.move(*s['move'])
|
||||
if 'key' in s: page.keyboard.press(s['key'])
|
||||
page.wait_for_timeout(s.get('wait', 1500))
|
||||
if 'shot' in s: page.screenshot(path='/shots/out/' + s['shot'] + '.png')
|
||||
os.makedirs('/shots/out', exist_ok=True)
|
||||
with sync_playwright() as p:
|
||||
# title and bestiary
|
||||
b, page = page_with(p, {'dc.lang': 'en'})
|
||||
page.mouse.move(1270, 790); page.wait_for_timeout(500)
|
||||
page.screenshot(path='/shots/out/title-battle.png')
|
||||
b.close()
|
||||
# scenes from savegames: Continue on the title screen
|
||||
for f in sorted(glob.glob('/shots/*.json')):
|
||||
name = os.path.basename(f)[:-5]
|
||||
b, page = page_with(p, {'dc.lang': 'en', 'dc.autosave': open(f).read()})
|
||||
steps(page, [{'click': [635, 207], 'wait': 6000}, {'move': [700, 160], 'wait': 3000, 'shot': name}])
|
||||
b.close()
|
||||
# the editors (English button positions)
|
||||
b, page = page_with(p, {'dc.lang': 'en'})
|
||||
steps(page, [
|
||||
{'click': [635, 255], 'wait': 2000}, {'click': [840, 20], 'wait': 1500},
|
||||
{'click': [840, 172], 'wait': 3000}, {'move': [700, 420], 'wait': 800, 'shot': 'editor-campaign'},
|
||||
{'click': [200, 200], 'wait': 1500}, {'click': [336, 61], 'wait': 1500}, {'move': [1000, 120], 'wait': 600, 'shot': 'editor-triggers'},
|
||||
{'click': [750, 136], 'wait': 2000}, {'move': [900, 500], 'wait': 600, 'shot': 'editor-blocks'},
|
||||
{'click': [70, 22], 'wait': 1500}, {'click': [246, 61], 'wait': 1200}, {'click': [200, 183], 'wait': 4000},
|
||||
{'click': [250, 145], 'wait': 1500}, {'move': [1000, 600], 'wait': 800, 'shot': 'editor-map'},
|
||||
])
|
||||
b.close()
|
||||
Reference in new issue
Block a user