# Examples
Tetra has a fairly large suite of examples - to try them out, clone the repository and run:
```bash
cargo run --example example_name
```
You can also click on the name of the example below to view the source code.
| [`hello_world`](https://github.com/17cupsofcoffee/tetra/blob/main/examples/hello_world.rs) | Basic | Opens a window and clears it with a solid color. |
| [`texture`](https://github.com/17cupsofcoffee/tetra/blob/main/examples/texture.rs) | Graphics | Loads and displays a texture. |
| [`shaders`](https://github.com/17cupsofcoffee/tetra/blob/main/examples/shaders.rs) | Graphics | Uses a custom shader to render a texture. |
| [`canvas`](https://github.com/17cupsofcoffee/tetra/blob/main/examples/canvas.rs) | Graphics | Uses a custom render target to apply post-processing effects. |
| [`mesh`](https://github.com/17cupsofcoffee/tetra/blob/main/examples/mesh.rs) | Graphics | Draws a custom mesh using vertex data. |
| [`animation`](https://github.com/17cupsofcoffee/tetra/blob/main/examples/animation.rs) | Graphics | Displays an animation, made up of regions from a texture. |
| [`text`](https://github.com/17cupsofcoffee/tetra/blob/main/examples/text.rs) | Graphics | Displays text using a TTF font. |
| [`nineslice`](https://github.com/17cupsofcoffee/tetra/blob/main/examples/nineslice.rs) | Graphics | Slices a texture into nine segments to display a dialog box. |
| [`scaling`](https://github.com/17cupsofcoffee/tetra/blob/main/examples/scaling.rs) | Graphics | Demonstrates the different screen scaling algorithms. |
| [`camera`](https://github.com/17cupsofcoffee/tetra/blob/main/examples/camera.rs) | Graphics | Demonstrates how to use a camera to transform the scene. |
| [`interpolation`](https://github.com/17cupsofcoffee/tetra/blob/main/examples/interpolation.rs) | Graphics | Demonstrates how to interpolate between updates. |
| [`shapes`](https://github.com/17cupsofcoffee/tetra/blob/main/examples/shapes.rs) | Graphics | Demonstrates how to draw primitive shapes. |
| [`stencil`](https://github.com/17cupsofcoffee/tetra/blob/main/examples/stencil.rs) | Graphics | Demonstrates how to use stencil buffers. |
| [`audio`](https://github.com/17cupsofcoffee/tetra/blob/main/examples/audio.rs) | Audio | Plays back an audio file. |
| [`keyboard`](https://github.com/17cupsofcoffee/tetra/blob/main/examples/keyboard.rs) | Input | Moves a texture around based on keyboard input. |
| [`animation_controller`](https://github.com/17cupsofcoffee/tetra/blob/main/examples/animation_controller.rs) | Input | Moves a sprite around, with the animation changing based on keyboard input. |
| [`mouse`](https://github.com/17cupsofcoffee/tetra/blob/main/examples/mouse.rs) | Input | Moves a texture around based on mouse input. |
| [`gamepad`](https://github.com/17cupsofcoffee/tetra/blob/main/examples/gamepad.rs) | Input | Displays the input from a connected gamepad. |
| [`text_input`](https://github.com/17cupsofcoffee/tetra/blob/main/examples/text_input.rs) | Input | Displays text as it is typed in by the player. |
| [`file_drop`](https://github.com/17cupsofcoffee/tetra/blob/main/examples/file_drop.rs) | Input | Loads a file that the user drags and drops into the window. |
| [`events`](https://github.com/17cupsofcoffee/tetra/blob/main/examples/events.rs) | Input | Shows what events can be fired by the engine. |
| [`error_handling`](https://github.com/17cupsofcoffee/tetra/blob/main/examples/error_handling.rs) | Error Handling | Demonstrates how custom error types and error reporting crates can be used in a Tetra game. |
| [`bunnymark`](https://github.com/17cupsofcoffee/tetra/blob/main/examples/bunnymark.rs) | Benchmark | Benchmarks rendering performance by rendering lots of bunnies. |
| [`text_perf`](https://github.com/17cupsofcoffee/tetra/blob/main/examples/text_perf.rs) | Graphics | Shows best practices for rendering text efficiently in Tetra. |
| [`ecs`](https://github.com/17cupsofcoffee/tetra/blob/main/examples/ecs.rs) | Integration | Demonstrates how ECS (entity component system) libraries can be used with Tetra. |
| [`tetras`](https://github.com/17cupsofcoffee/tetra/blob/main/examples/tetras.rs) | Game | A full example game (which is entirely legally distinct from a certain other block-based puzzle game *cough*). |