mirror of
https://github.com/lisk77/comet.git
synced 2025-10-23 21:38:50 +00:00
feat: added examples to the repo
This commit is contained in:
parent
27a3ab6408
commit
e94df6c221
5 changed files with 65 additions and 1 deletions
17
examples/hello_world.rs
Normal file
17
examples/hello_world.rs
Normal 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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue