Skip to main content


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.

hello_worldBasicOpens a window and clears it with a solid color.
textureGraphicsLoads and displays a texture.
shadersGraphicsUses a custom shader to render a texture.
canvasGraphicsUses a custom render target to apply post-processing effects.
meshGraphicsDraws a custom mesh using vertex data.
animationGraphicsDisplays an animation, made up of regions from a texture.
textGraphicsDisplays text using a TTF font.
ninesliceGraphicsSlices a texture into nine segments to display a dialog box.
scalingGraphicsDemonstrates the different screen scaling algorithms.
cameraGraphicsDemonstrates how to use a camera to transform the scene.
interpolationGraphicsDemonstrates how to interpolate between updates.
shapesGraphicsDemonstrates how to draw primitive shapes.
stencilGraphicsDemonstrates how to use stencil buffers.
audioAudioPlays back an audio file.
keyboardInputMoves a texture around based on keyboard input.
animation_controllerInputMoves a sprite around, with the animation changing based on keyboard input.
mouseInputMoves a texture around based on mouse input.
gamepadInputDisplays the input from a connected gamepad.
text_inputInputDisplays text as it is typed in by the player.
file_dropInputLoads a file that the user drags and drops into the window.
eventsInputShows what events can be fired by the engine.
error_handlingError HandlingDemonstrates how custom error types and error reporting crates can be used in a Tetra game.
bunnymarkBenchmarkBenchmarks rendering performance by rendering lots of bunnies.
ecsIntegrationDemonstrates how ECS (entity component system) libraries can be used with Tetra.
tetrasGameA full example game (which is entirely legally distinct from a certain other block-based puzzle game cough).