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. |
shaders |
Graphics | Uses a custom shader to render a texture. |
canvas |
Graphics | Uses a custom render target to apply post-processing effects. |
mesh |
Graphics | Draws a custom mesh using vertex data. |
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. |
camera |
Graphics | Demonstrates how to use a camera to transform the scene. |
interpolation |
Graphics | Demonstrates how to interpolate between updates. |
shapes |
Graphics | Demonstrates how to draw primitive shapes. |
stencil |
Graphics | Demonstrates how to use stencil buffers. |
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. |
file_drop |
Input | Loads a file that the user drags and drops into the window. |
events |
Input | Shows what events can be fired by the engine. |
error_handling |
Error Handling | Demonstrates how custom error types and error reporting crates can be used in a Tetra game. |
bunnymark |
Benchmark | Benchmarks rendering performance by rendering lots of bunnies. |
text_perf |
Graphics | Shows best practices for rendering text efficiently in Tetra. |
ecs |
Integration | Demonstrates how ECS (entity component system) libraries can be used with Tetra. |
tetras |
Game | A full example game (which is entirely legally distinct from a certain other block-based puzzle game cough). |