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 Basic Opens a window and clears it with a solid color.
texture Graphics Loads and displays a texture.
animation Graphics Displays an animation, made up of regions from a texture.
text Graphics Displays text using a TTF font.
nineslice Graphics Slices a texture into nine segments to display a dialog box.
scaling Graphics Demonstrates the different screen scaling algorithms.
shaders Graphics Uses a custom shader to render a texture.
canvas Graphics Uses a custom render target to apply post-processing effects.
interpolation Graphics Demonstrates how to interpolate between ticks.
audio Audio Plays back an audio file.
keyboard Input Moves a texture around based on keyboard input.
animation_controller Input Moves a sprite around, with the animation changing based on keyboard input.
mouse Input Moves a texture around based on mouse input.
gamepad Input Displays the input from a connected gamepad.
text_input Input Displays text as it is typed in by the player.
bunnymark Benchmark Benchmarks rendering performance by rendering lots of bunnies.
tetras Game A full example game (which is entirely legally distinct from a certain other block-based puzzle game cough).