Struct nannou::app::App [] [src]

pub struct App {
    pub audio: Audio,
    pub mouse: Mouse,
    pub window: Window,
    pub keys: Keys,
    pub duration: Time,
    // some fields omitted
}

An App represents the entire context of your application.

The App owns and manages:

  • The window and input event loop used to drive the application forward.
  • All OpenGL windows for graphics and user input. Windows can be referenced via their IDs.
  • The audio event loop from which you can receive or send audio via streams.

Fields

The App's audio-related API.

The current state of the Mouse.

State of the window currently in focus.

State of the keyboard keys.

mods provides state of each of the modifier keys: shift, ctrl, alt, logo.

down is the set of keys that are currently pressed.

NOTE: down this is tracked by the nannou App so issues might occur if e.g. a key is pressed while the app is in focus and then released when out of focus. Eventually we should change this to query the OS somehow, but I don't think winit provides a way to do this yet.

Key time measurements tracked by the App.

duration.since_start specifies the duration since the app started running.

duration.since_prev_update specifies the duration since the previous update event.

Methods

impl App
[src]

ASSETS_DIRECTORY_NAME: &'static str = "assets"

DEFAULT_EXIT_ON_ESCAPE: bool = true

[src]

Find and return the absolute path to the project's assets directory.

This method looks for the assets directory in the following order:

  1. Checks the same directory as the executable.
  2. Recursively checks exe's parent directories (to a max depth of 5).
  3. Recursively checks exe's children directories (to a max depth of 3).

[src]

Begin building a new OpenGL window.

[src]

The number of windows currently in the application.

[src]

A reference to the window with the given Id.

[src]

A reference to the window currently in focus.

Panics if their are no windows open in the App.

Uses the App::window method internally.

TODO: Currently this produces a reference to the focused window, but this behaviour should be changed to track the "main" window (the first window created?).

[src]

Return whether or not the App is currently set to exit when the Escape key is pressed.

[src]

Specify whether or not the app should close when the Escape key is pressed.

By default this is true.

[src]

Returns the App's current LoopMode.

[src]

Sets the loop mode of the App.

Note: Setting the loop mode will not affect anything until the end of the current loop iteration. The behaviour of a single loop iteration is described under each of the LoopMode variants.

[src]

A handle to the App that can be shared across threads.

This can be used to "wake up" the App's inner event loop.

[src]

Create a new Ui for the window with the given Id.

Returns None if there is no window for the given window_id.

[src]

Produce the App's Draw API for drawing geometry and text with colors and textures.

Note: There may only be a single app::Draw instance at any point in time. If this method is called while there is a pre-existing instance of app::Draw this method will panic.

Returns None if there is no window for the given window::Id.

[src]

Produce the App's Draw API for drawing geometry and text with colors and textures.

This is a simplified wrapper around the App::draw_for_window method that draws to the window currently in focus.

Panics if there are no windows open.

Note: There may only be a single app::Draw instance at any point in time. If this method is called while there is a pre-existing instance of app::Draw this method will panic.

Trait Implementations

Auto Trait Implementations

impl !Send for App

impl !Sync for App