feat: added examples to the repo

This commit is contained in:
lisk77 2025-03-11 01:13:05 +01:00
parent 27a3ab6408
commit e94df6c221
5 changed files with 65 additions and 1 deletions

17
examples/hello_world.rs Normal file
View file

@ -0,0 +1,17 @@
use comet::prelude::*;
// This function will only be called once before the event loop starts.
fn setup(app: &mut App, renderer: &mut Renderer2D) {}
// This function will be called on every tick after the event loop starts.
fn update(app: &mut App, renderer: &mut Renderer2D, dt: f32) {}
fn main() {
// This creates a window with the title "Hello world".
// Note: You can call your functions differently if you want to though it is advised to use
// `setup` and `update` as the names.
// You can also replace `Renderer2D` with any other struct that implements the `Renderer` trait.
App::new()
.with_title("Hello world")
.run::<Renderer2D>(setup, update);
}