Expand description
Optional desktop host for running Apps against a real wgpu
surface in a winit window.
Most native apps should use this crate instead of calling
aetna-wgpu directly:
ⓘ
use aetna_core::prelude::*;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let viewport = Rect::new(0.0, 0.0, 720.0, 480.0);
aetna_winit_wgpu::run("My Aetna App", viewport, MyApp::default())
}The host owns the event loop, window, device/queue, surface
configuration, render pass boundaries, input mapping, IME forwarding,
and animation redraw cadence. Your code owns the App: application
state, App::build, App::on_event, optional hotkeys, custom
shaders, and theme.
run takes an App and runs an event loop that:
- Calls
App::buildon every redraw, applying current hover/press visuals automatically before paint. - Routes
winitpointer events through the renderer’s hit-tester and dispatches events back viaApp::on_event. - Routes Tab/Shift-Tab through focus traversal and Enter/Space/Escape through keyboard events.
- Copies the current Aetna text selection to the native clipboard on Ctrl/Cmd+C.
- Requests a redraw whenever interaction state changes (mouse move, button down/up) so hover/press visuals are immediate.
Use run_with_config when a simple app needs a fixed redraw
cadence for external live state such as meters. Put per-frame state
refresh in App::before_build. For fully custom render-loop
integration, bypass this crate and call aetna_wgpu::Runner
directly.
Structs§
- Host
Config - Configuration for the optional native winit + wgpu host.
Traits§
- Winit
Wgpu App - Compatibility extension point for apps that use this host crate.
Functions§
- run
- Run a windowed app. Blocks until the user closes the window.
- run_
host_ app - Run a windowed app with default host configuration.
- run_
host_ app_ on_ event_ loop - Run a host-specific
WinitWgpuAppusing a caller-created winit event loop. - run_
host_ app_ with_ config - Run a windowed app with host-specific configuration.
- run_
on_ event_ loop - Run a plain
Appusing a caller-created winit event loop. - run_
with_ config - Run a windowed app with host-specific configuration.