Struct tetra::graphics::scaling::ScreenScaler[][src]

pub struct ScreenScaler { /* fields omitted */ }
Expand description

A wrapper for a Canvas that handles scaling the image to fit the screen.

Examples

The scaling example demonstrates how to use a ScreenScaler with each of the different scaling algorithms.

Implementations

Returns a new ScreenScaler, with the specified inner and outer width and height. The mode will determine how the image is scaled to fit the screen.

Returns a new ScreenScaler, with the specified inner width and height, and the outer size set to the current dimensions of the window.

Draws the scaled image to the screen.

Updates the scaler’s outer size (i.e. the size of the box that the screen will be scaled to fit within).

Returns a reference to the canvas that is being scaled.

Returns the current scaling mode.

Sets the scaling mode that should be used.

Converts a point from window co-ordinates to scaled screen co-ordinates.

Converts a point from scaled screen co-ordinates to window co-ordinates.

Returns the position of the mouse in scaled screen co-ordinates.

This is a shortcut for calling .project(input::get_mouse_position(ctx)).

Returns the X co-ordinate of the mouse in scaled screen co-ordinates.

This is a shortcut for calling project(input::get_mouse_position(ctx)).x.

Returns the Y co-ordinate of the mouse in scaled screen co-ordinates.

This is a shortcut for calling project(input::get_mouse_position(ctx)).y.

Trait Implementations

Formats the value using the given formatter. Read more

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.