docs.rs failed to build gapp-winit-0.13.2
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build:
gapp-winit-0.13.1
gapp-winit
An abstract event loop library for winit-based applications with support for OpenGL/glutin and wgpu backends. Integrates seamlessly with gapp traits for clean separation of input, update, render, and present.
Supports native (Windows/Linux/macOS) and WASM. Fixed-timestep FPS cap, automatic resize handling, multi-window support.
Features
- Multi-window: Manage multiple windows via
Windows<R>collection, with per-window event routing. - Backend-agnostic: Switch between OpenGL and wgpu via Cargo features. The two are alternatives — each defines its own
WindowData, so enabling both fails to compile with an explicit message. Select wgpu withdefault-features = false. - egui integration:
EguiState(featureegui, pulls inwgpu) bundles the egui context,egui-winitinput state, andegui-wgpurenderer for one window. - wgpu present helper:
WindowData::present_wgpucovers the acquire/submit/present dance, including surface reconfiguration onOutdated. - Trait-based: Implement
WindowInput,Present,Render(gapp),Update(gapp). - Cross-platform: Full WASM support (HTML canvas).
- Performance: Fixed timestep, on-demand redraw, FPS sleep (native), optional render-on-demand loop (
run_on_demand).
| Feature | OpenGL | wgpu |
|---|---|---|
| Native | ✅ | ✅ |
| WASM | ✅ | ✅ |
| Default | ✅ | ❎️ |
Quickstart
For reference, have a look at the template program. It also can be used as a base for your program.
Traits Overview
WindowInput<C, R>: Handle allWindowEvents (post-resize/redraw) withWindowIdand&mut Windows<R>. Callevent_loop.exit()on close. Optionaldevice_inputhook for rawDeviceEvents (e.g. relative mouse motion), no-op by default.Present<R>: Submit frame per window (e.g.,queue.submit(),surface.swap_buffers()).Render<R>/Update(from gapp): Standard render/update loop, called per window.Windows<R>: Collection mappingWindowId→(WindowData, R). Insert/remove windows dynamically.
Resize is auto-handled per window.
FPS can be supplied to run.
run_on_demand is the battery-friendly alternative: the loop sleeps until input, a window event, a FrameWaker::wake from any thread, or Animation::is_animating returning true, and then updates and redraws at most fps times per second.