pub struct Context<A: App> { /* private fields */ }
Expand description

The main entry point into the engine context. All state is initialized by this type.

Implementations

Asset related functions.

Requests a read of an asset. This produces an AssetRead event with the result of the read once it has completed.

Platform-specific
  • Non-web: The path is relative to the current working directory.
  • Web: The path is relative to the current url’s root.

Graphics and window related functions.

Returns a simple 1x1 white texture. This texture is reused globally.

Gets the max texture size supported on the GPU.

Gets the max anisotropic texture filtering supported by the GPU. Returns None if unsupported.

Sets the title of the window.

Platform-specific
  • Web: This sets the page title.

Sets the display mode of the window.

Gets the logical size of the window. This may differ from the viewport’s logical size.

Gets the physical size of the window. This may differ from the viewport’s physical size.

Grabs the cursor, preventing it from leaving the window.

Platform-specific
  • macOS: This locks the cursor in a fixed location, which looks visually awkward.

Sets the visibility of the cursor.

Platform-specific
  • Windows: The cursor is only hidden within the confines of the window.
  • X11: The cursor is only hidden within the confines of the window.
  • Wayland: The cursor is only hidden within the confines of the window.
  • macOS: The cursor is hidden as long as the window has input focus, even if the cursor is outside of the window.

Gets the logical size of the viewport. This may differ from the window’s logical size.

Gets the physical size of the viewport. This may differ from the window’s physical size.

Clears the screen buffers according to the clear mode.

Event loop related functions.

Stops the context after the next update.

Prevents the update event from being sent for at least the duration. If a periodic wait is active, this wait will temporarily override only if it causes the next update event to happen later than the periodic wait would have.

Prevents the update event from being sent until at least the given instant. If a periodic wait is active, this wait will temporarily override only if it causes the next update event to happen later than the periodic wait would have.

Prevents the update event from being sent more frequently than the given duration. Set this to None to disable the periodic wait.

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

Performs the conversion.

Performs the conversion.

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.