Struct nitro::App [] [src]

pub struct App {
    pub input: Input,
    pub camera: Camera,
    pub world: World<f32>,
    pub audio: Audio,
    pub screen_to_world_ratio: f32,
    pub cull_padding: u32,
    // some fields omitted
}

This structure represents a game instance.

This structure is responsible for managing asset loading, processing input, rendering the game and playing audio.

Fields

How many pixels = 1 game world unit. Defaults to 100.

Distance in pixels from screen at which an object won't be drawn. Defaults to 750.

Methods

impl App
[src]

Constructs a new App using the given name for the window title.

Begin execution of the game.

This function won't return until the game has been quit. If profiling is true then additional information on game processing durations will be printed to console.

Exit the game

Signals that it's time to quit. Execution will stop at the end of the current frame.

Creates a new GameObject

GameObjects are typically physical objects in your game world, such as characters or decorative objects.

Parameter f will be called on the newly created GameObject, allowing you to initialize it. Returns the id of the new GameObject, which can be used to retrieve this GameObject later.

Retrieves a reference to an existing GameObject by the GameObject's id.

Returns Away if and only if the GameObject exists but is currently loaned out in another borrow.

Hint: That borrow is most likely in the game_object parameter of the receive_message function.

Retrieves a mutable reference to an existing GameObject by the GameObject's id.

Returns Away if and only if the GameObject exists but is currently loaned out in another borrow.

Hint: That borrow is most likely in the game_object parameter of the receive_message function.

Loads a texture and returns it for use.

texture_name is the file name of the texture relative to assets/textures (assets\textures on Windows)