classic-platform

Documents platform backends and input handling for the classic-wgl Rust game engine.

1|1|Updated Aug 18, 2021
One-click install
npx skills add https://github.com/guilledk/classic-wgl --skill classic-platform-guilledk
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: classic-platform
Source: https://github.com/guilledk/classic-wgl/tree/main/.agents/skills/classic-platform
Command: npx skills add https://github.com/guilledk/classic-wgl --skill classic-platform-guilledk

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Working with classic-wgl's platform layer requires understanding three divergent backends (native winit/glutin, web web-sys, headless EGL) plus subtle input, timing, and build quirks that are easy to get wrong when porting, debugging, or extending the engine. ## Core Features & Use Cases - Backend Reference: Explains the Platform trait and its three implementations — NativePlatform (winit + glutin), WebPlatform (web-sys + trunk), and HeadlessPlatform (EGL pbuffer) — including event loops and GL context setup. - Input & Timing Semantics: Details InputState fields, mouse wheel sign conventions and decay, frame timing (real delta, CLASSIC_FIXED_DT), and deterministic headless runs via CLASSIC_FRAMES. - Known Divergences: Documents non-functional or divergent behavior such as unimplemented native accessors, stale web resize closures, and frame_had_click persistence. - Use Case: When a golden test fails in CI, use this Skill to understand how CLASSIC_HEADLESS, CLASSIC_FRAMES, and CLASSIC_FIXED_DT interact to produce deterministic headless renders. ## Quick Start Ask the AI to explain how mouse wheel input differs between the native and web backends of classic-wgl and how the engine normalizes it.

Frequently Asked Questions about classic-platform

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run classic-wgl headless for CI golden tests?

Set CLASSIC_HEADLESS=1 to activate the EGL pbuffer backend and CLASSIC_FRAMES to a frame count to control when the loop exits. Combine with CLASSIC_FIXED_DT (auto-defaulting to 1/60 under CLASSIC_TEST) for deterministic frame timing.

How does mouse wheel input differ between winit and web-sys backends?

The native backend adds wheel deltas (positive = scroll up), scaling LineDelta by 50.0, while the web backend subtracts deltaY to flip the browser convention. The engine then applies decay, a deadzone, and clamps the value to [-1, 1] each frame.

Does the web backend support pointer lock for mouse look?

Yes. On a left mousedown while unfocused, the web backend calls request_pointer_lock, and pointerlockchange events sync InputState.focused. While locked, mousemove accumulates movement_x/movement_y deltas instead of absolute client coordinates.

Why does mouse position clamping break after resizing the browser window?

The web mousemove closure captures canvas width and height at creation time. The resize listener updates the canvas element but not the captured variables, so clamping uses stale dimensions until the page reloads.

What are the limitations of the Platform trait accessors?

NativePlatform::window() and gl_context() return unimplemented!() and would panic if called; HeadlessPlatform::window() is also unimplemented. Only run_loop is used in practice, since it takes ownership and drives the event loop.