RemoteControl
Exposes a program over a local HTTP server: a screenshot of the current frame can be requested, and keyboard/mouse events can be injected as if a real user produced them -- intended for driving an OPENRNDR program from an external tool (a test suite, an agent) that can't attach to the window directly.
All routes are served on network:port (default 127.0.0.1:9000, i.e. not reachable from outside the machine by default -- change network deliberately if that's not what you want).
Routes
GET /screenshot-- waits for the next frame and returns it as a PNG.POST /keyboard/down?name=<key>,POST /keyboard/up?name=<key>,POST /keyboard/repeat?name=<key>-- inject a key event.nameis the layout-sensitive key name as used by org.openrndr.KeyEvent.name (e.g.a,spacebar,arrow-left). An optionalmodifiersquery parameter takes a comma-separated list ofSHIFT,CTRL,ALT,SUPER.POST /mouse/move?x=<x>&y=<y>-- move the mouse to an absolute window position.POST /mouse/button/down?x=<x>&y=<y>&button=<LEFT|RIGHT|CENTER>,POST /mouse/button/up?...-- press/release a mouse button, optionally moving tox/yfirst (omitx/yto use the current position).POST /mouse/scroll?dx=<dx>&dy=<dy>-- inject a scroll event.POST /clock?time=<seconds>-- freeze Program.seconds at a fixed value, e.g. for deterministic, reproducible screenshots of an animation at a specific point in time.POST /clock/resetrestores the real (or otherwise previously active) clock.
All events are delivered through the same (thread-safe, postponed) event queue real input uses, applied on the program's own thread right before the next frame is drawn -- so this is safe to call from any thread, including ktor's own request-handling threads.