Files
wsg/lib/examples/simple.rs
T
Jérôme Bousquié 7cabda710d examples: fix simple.rs to compile as the 15-line declarative model
- Replace the broken App::new() (which does not exist) with AppBuilder.
- Strip it down to the PLAN's ~15-line target: no explicit winit/wgpu,
  AppHandler render() left empty (scene rendering still on the roadmap).
- Verified: builds, opens a black window and runs the update->render->present
  loop until closed.
- Update README/PLAN wording now that the simple example compiles (it still
  does not draw a scene).
2026-09-14 15:42:30 +02:00

20 lines
684 B
Rust

//! Workflow déclaratif minimal (~15 lignes), sans manipulation WGPU explicite.
//! `AppBuilder` ouvre la fenêtre, construit le `Context`/`Renderer` et fait tourner la boucle
//! update → render → present. Le rendu automatisé de la scène n'est pas encore en place
//! (README, Roadmap étape 1) : `render()` est donc vide pour l'instant.
use wsg_lib::app::AppBuilder;
use wsg_lib::utils::WsgError;
use wsg_lib::{App, AppHandler};
struct MonQuad;
impl AppHandler for MonQuad {
fn render(&mut self, _app: &mut App) {}
}
#[pollster::main]
async fn main() -> Result<(), WsgError> {
let app = AppBuilder::new().title("WSG Simple").build().await?;
app.run(MonQuad)
}