[][src]Module tetra::graphics

Functions and types relating to rendering.

This module implements a (hopefully!) efficent quad renderer, which will queue up drawing operations until it is absolutely necessary to send them to the graphics hardware. This allows us to minimize the number of draw calls made, speeding up rendering.

Re-exports

pub use self::animation::Animation;
pub use self::ui::NineSlice;

Modules

animation

Functions and types relating to animations.

ui

Functions and types relating to user interfaces.

Structs

Canvas

A 2D texture that can be used for off-screen rendering.

Color

Represents an RGBA color.

DrawParams

Struct representing the parameters that can be used when drawing.

Font

A font that can be used to render text. TrueType fonts (.ttf) and a subset of OpenType fonts (.otf) are supported.

Rectangle

A rectangle of f32s.

Shader

A shader program, consisting of a vertex shader and a fragment shader.

Text

A piece of text that can be rendered.

Texture

A 2D texture, held in GPU memory.

Enums

FilterMode

Represents the different filtering algorithms that can be used when scaling an image.

ScreenScaling

Defines the different ways that a game's screen can be scaled.

Statics

DEFAULT_FRAGMENT_SHADER

The default fragment shader.

DEFAULT_VERTEX_SHADER

The default vertex shader.

Traits

Drawable

Represents a type that can be drawn.

UniformValue

Represents a type that can be passed as a uniform value to a shader.

Functions

clear

Clears the screen (or a canvas, if one is enabled) to the specified color.

draw

Draws an object to the screen (or to a canvas, if one is enabled).

flush

Sends queued data to the graphics hardware.

get_default_filter_mode

Returns the filter mode that will be used by newly created textures and canvases.

get_internal_height

Gets the internal height of the screen.

get_internal_size

Gets the internal size of the screen.

get_internal_width

Gets the internal width of the screen.

get_scaling

Gets the current scaling mode.

present

Presents the result of drawing commands to the screen, scaling/letterboxing if necessary.

reset_canvas

Sets the renderer back to drawing to the screen directly.

reset_shader

Sets the renderer back to using the default shader.

set_canvas

Sets the renderer to redirect all drawing commands to the specified canvas.

set_default_filter_mode

Sets the filter mode that will be used by newly created textures and canvases.

set_internal_height

Sets the internal height of the screen.

set_internal_size

Sets the internal size of the screen.

set_internal_width

Sets the internal width of the screen.

set_letterbox_color

Sets the color of the letterbox bars that are displayed when scaling the screen.

set_scaling

Sets the current scaling mode.

set_shader

Sets the shader that is currently being used for rendering.

set_texture

Sets the texture that is currently being used for rendering.

Type Definitions

Vec2

A 2D vector with f32 components.