Skip to main content

Crate aetna_winit_wgpu

Crate aetna_winit_wgpu 

Source
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::build on every redraw, applying current hover/press visuals automatically before paint.
  • Routes winit pointer events through the renderer’s hit-tester and dispatches events back via App::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§

HostConfig
Configuration for the optional native winit + wgpu host.

Traits§

WinitWgpuApp
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 WinitWgpuApp using 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 App using a caller-created winit event loop.
run_with_config
Run a windowed app with host-specific configuration.