wume

Crates.iowume
lib.rswume
version0.2.0
created_at2025-07-08 11:32:06.88003+00
updated_at2026-01-13 08:19:44.937882+00
descriptionQuick setup for wgpu application.
homepage
repositoryhttps://github.com/blindley/wume
max_upload_size
id1742519
size74,459
Benjamin Lindley (blindley)

documentation

README

Examples

// Minimal example of a WGPU/Winit application using Wume
// This example creates a window and renders a solid color to it.

use std::sync::Arc;
use wume::{wgpu, winit};

use winit::application::ApplicationHandler;
use winit::window::Window;

struct App {
    context: wume::WgpuContext,
}

impl From<Arc<Window>> for App {
    fn from(window: Arc<Window>) -> Self {
        let context = wume::WgpuContext::new(window).unwrap();
        Self { context }
    }
}

impl ApplicationHandler for App {
    fn resumed(&mut self, _event_loop: &winit::event_loop::ActiveEventLoop) {}

    fn window_event(
        &mut self,
        event_loop: &winit::event_loop::ActiveEventLoop,
        _window_id: winit::window::WindowId,
        event: winit::event::WindowEvent,
    ) {
        use winit::event::WindowEvent;
        match event {
            WindowEvent::CloseRequested => {
                event_loop.exit();
            }

            WindowEvent::Resized(size) => {
                self.context.resize(size.width, size.height);
            }

            WindowEvent::RedrawRequested => {
                let clear_color = wgpu::Color { r: 0.5, g: 0.2, b: 0.2, a: 1.0, };
                self.context.simple_frame(clear_color, |_render_pass| {
                    // nothing to do here, simple_frame handles clearing the screen
                });
            }
            _ => {}
        }
    }
}

fn main() {
    let window_attributes = winit::window::WindowAttributes::default();
    wume::lazy_run::<App>(Some(window_attributes)).unwrap()
}
Commit count: 5

cargo fmt