# Examples

Tetra has a fairly large suite of examples - to try them out, clone the repository and run:

cargo run --example example_name

You can also click on the name of the example below to view the source code.

Name Category Description
hello_world (opens new window) Basic Opens a window and clears it with a solid color.
texture (opens new window) Graphics Loads and displays a texture.
shaders (opens new window) Graphics Uses a custom shader to render a texture.
canvas (opens new window) Graphics Uses a custom render target to apply post-processing effects.
mesh (opens new window) Graphics Draws a custom mesh using vertex data.
animation (opens new window) Graphics Displays an animation, made up of regions from a texture.
text (opens new window) Graphics Displays text using a TTF font.
nineslice (opens new window) Graphics Slices a texture into nine segments to display a dialog box.
scaling (opens new window) Graphics Demonstrates the different screen scaling algorithms.
camera (opens new window) Graphics Demonstrates how to use a camera to transform the scene.
interpolation (opens new window) Graphics Demonstrates how to interpolate between updates.
audio (opens new window) Audio Plays back an audio file.
keyboard (opens new window) Input Moves a texture around based on keyboard input.
animation_controller (opens new window) Input Moves a sprite around, with the animation changing based on keyboard input.
mouse (opens new window) Input Moves a texture around based on mouse input.
gamepad (opens new window) Input Displays the input from a connected gamepad.
text_input (opens new window) Input Displays text as it is typed in by the player.
file_drop (opens new window) Input Loads a file that the user drags and drops into the window.
events (opens new window) Input Shows what events can be fired by the engine.
error_handling (opens new window) Error Handling Demonstrates how custom error types and error reporting crates can be used in a Tetra game.
bunnymark (opens new window) Benchmark Benchmarks rendering performance by rendering lots of bunnies.
tetras (opens new window) Game A full example game (which is entirely legally distinct from a certain other block-based puzzle game cough).
Last updated: 11/28/2020, 1:29:05 PM