doc
This commit is contained in:
+3
-14
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user