pub struct GameControl { /* private fields */ }
Expand description

Main context, for controlling the game while it is running. You don’t normally need to create this yourself as Gameloop::new() does this for you, but it can be useful to create this directly if you need to run automated tests.

Implementations

Creates a GameControl in a headless configuration, allowing you to run automated tests, validation, or other processes without needing a gameloop, window, renderer, or audio.

Retrieves the Input object for reading player input such as keyboard, mouse, and gamepad.

Retrieves the Input object mutably for changing input bindings and deadzones

Retrieves the Renderer object to read various parameters for the renderer window

Retrieves the Renderer object mutably to change various parameters for the renderer window

Retrieves the Audio object for reading information about audio playback

Retrieves the Audio object mutably to control audio playback

Retrieves the SourceManager for registering and querying data Sources

Retrieves the DataMultistore for accessing data resources

Retrieves the GameSingleton of the current type mutably. If it has not been created yet, it will be Default-constructed.

Returns the framerate that game logic is synchronized to, in frames per second

Sets the framerate that game logic is synchronized to, in frames per second

Returns the mode to use for interpolating frames in the renderer.

Sets the mode to use for interpolating frames in the renderer.

Returns the framerate cap mode for when frame interpolation is enabled.

Sets the framerate cap mode for when frame interpolation is enabled.

Returns the framerate pacing mode for when frame interpolation is enabled.

Sets the framerate pacing mode for when frame interpolation is enabled.

Returns true if frame interpolation is currently active. For the automatic mode, returns true if the refresh rate of the window’s current monitor does not match with the target logic framerate.

Retrieves the ConsoleHistory object, which is useful for implementing an in-game console window

Retrieves the GameStats object, which contains timing statistics

Switches the game to a new scene of the given SceneType after the current frame is done. Doing this will perform automatic unloading of unused data resources (ones without an active crate::datapack::DataHandle or crate::datapack::PackageUseToken) if it is configured to do so via the GameInfo passed in during creation of the Gameloop or GameControl.

Leaves the main gameloop. This usually means closing the game.

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

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait. Read more

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read more

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s. 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.

Should always be Self

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.