pub fn game<S>(
name: impl Into<String>,
update: impl Fn(&mut S),
) -> Game<S, impl Fn(&mut S)>Expand description
Entrypoint function for baba games.
This function creates a Game object, which you can set many options in. To start your game,
simply call .run() or .run_with(MyGame::new) on it. Check
out Game for the options you can set!
fn main() -> baba::Result {
baba::game("My game", MyGame::update)
.window_title("Hello!")
.run()
}
#[derive(Default)]
struct MyGame {
// ...
}If you don’t want to implement Default, you can instead use run_with:
fn main() -> baba::Result {
baba::game("My game", MyGame::update)
.run_with(MyGame::new)
}
impl MyGame {
fn new() -> Self {
Self {
// ...
}
}
}