Module pix_engine::state

source ·
Expand description

PixState methods for the Engine and PixEngine.

PixState is the global engine state and API for any application using pix-engine. A mutable reference is passed to most PixEngine methods and allows you to modify settings, query engine and input state, as well as drawing to the current render target.

The most common use of PixState is in the PixEngine::on_update method.

See the Getting Started section and the PixState page for the list of available methods.

Provided PixState methods:

Example

fn on_update(&mut self, s: &mut PixState) -> PixResult<()> {
    s.fill(s.theme().colors.primary);
    s.rect([100, 0, 100, 100])?;
    if s.button("Click me")? {
        s.text("I was clicked!");
    }
    Ok(())
}

Modules

Structs

  • Represents all state and methods for updating and interacting with the Engine.