pub struct Game {
    pub title: String,
    pub width: u32,
    pub height: u32,
    /* private fields */
}
Expand description

Representation of the game.

Fields

title: String

The title that the window displays.

width: u32

The width of the opened window

height: u32

The height of the opened window

Implementations

Creates a new Game struct.

Make sure to use Self::run() to actually begin the game logic.

Game::new("cool game", 1000, 1000);

Runs the game. Note: this method blocks, as it uses an infinite loop.

game.run(|ctx, events| {
    // Game logic goes here
});

Stops the game loop. This method should be called inside the closure that you passed to Self::run().

// ... in the game loop:
game.terminate();

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.