This commit is contained in:
Jérôme Bousquié
2026-07-08 15:46:50 +02:00
parent 724b658896
commit 7b25564483
25 changed files with 301 additions and 339 deletions
+3 -14
View File
@@ -1,6 +1,6 @@
use wsg_lib::app::{App, AppHandler};
use wsg_lib::resources::{Material, Mesh, Vertex};
use wsg_lib::utils;
use wsg_lib::{App, AppHandler};
// 1. On définit notre "Jeu" qui implémente le comportement
struct MonQuad {
@@ -9,24 +9,13 @@ struct MonQuad {
}
impl AppHandler for MonQuad {
fn render(&mut self, app: &mut App) {
// Le rendu devient simple : on accède aux outils via &mut app
if let Some(frame) = app.context.get_next_frame() {
app.renderer
.render(frame.view(), &self.mesh, &self.material);
app.renderer.present(frame);
}
}
fn render(&mut self, app: &mut App) {}
}
#[pollster::main]
async fn main() -> Result<(), wsg_lib::utils::WsgError> {
// 2. Initialisation via le Builder
let mut app = App::builder()
.title("Exemple Simple")
.size(800, 600)
.build()
.await?;
let mut app = App::new().await?;
// 3. Setup des ressources (déclaration)
app.cache