Module crayon::application

source ·
Expand description

A unified application model across all target platforms.

Application

An application needs to run on all types of esoteric host platforms. To hide trivial platform-specific details, we offers a convenient trait Application facade which defined methods, that will be called in a pre-determined order every frame.

The most intuitive and simple setup function could be something like:

use crayon::prelude::*;

struct Window {}
impl LifecycleListener for Window {}

fn main() {
    application::setup(Params::default(), || Ok(Window {}));
}

Engine

Engine mentioned above is the most fundamental module in crayon. It binds various essential systems in a central place, and responsible for running the main loop.

Modules

Structs

A structure containing configuration data for the game engine, which are used to specify hardware setup stuff to create the window and other context information.

Functions

Discard the core system.
Gets current fps.
Gets the duration duraing last frame.
Checks if the engine is running in headless mode.
Set maximum frames per second. The Time will sleep if fps is higher than this for less resource(e.g. power) consumptions.
Set maximum frames per second when the application does not have input focus.
Set minimum frames per second. If fps goes lower than this, time will appear to slow. This is useful for some subsystems required strict minimum time step per frame, such like Collision checks.
Set how many frames to average for timestep smoothing.
Setup the core system.
Checks if the engine is enabled.