#game #engine #framework #gamedev


A fork of a simple 2D game framework written in Rust

1 unstable release

0.0.1 Oct 24, 2021

#271 in #game-engine

Download history 3/week @ 2022-06-12 16/week @ 2022-06-19 9/week @ 2022-06-26 11/week @ 2022-07-03 11/week @ 2022-07-10 13/week @ 2022-07-17 12/week @ 2022-07-24 15/week @ 2022-07-31 27/week @ 2022-08-07 15/week @ 2022-08-14 20/week @ 2022-08-21 8/week @ 2022-08-28 21/week @ 2022-09-04 16/week @ 2022-09-11 26/week @ 2022-09-18 15/week @ 2022-09-25

81 downloads per month
Used in 3 crates (via firecore-engine)

MIT license

7.5K SLoC


Build Status Crates.io Documentation License

Tetra is a simple 2D game framework written in Rust. It uses SDL2 for event handling and OpenGL 3.2+ for rendering.


  • XNA/MonoGame-inspired API
  • Efficient 2D rendering, with draw call batching by default
  • Easy input handling, via polling or events, with support for gamepads
  • Deterministic game loop by default, à la Fix Your Timestep
  • Common building blocks built-in, such as:
    • Font rendering
    • Cameras
    • Screen scaling


To add Tetra to your project, add the following line to your Cargo.toml file:

tetra = "0.6"

You will also need to install the SDL2 native libraries - full details are provided in the documentation.


To get a simple window displayed on screen, the following code can be used:

use firecore_tetra::graphics::{self, Color};
use firecore_tetra::{Context, ContextBuilder, State};

struct GameState;

impl State for GameState {
    fn draw(&mut self, ctx: &mut DefaultContext) -> firecore_tetra::Result {
        // Cornflower blue, as is tradition
        graphics::clear(ctx, Color::rgb(0.392, 0.584, 0.929));

fn main() -> firecore_tetra::Result {
    ContextBuilder::new("Hello, world!", 1280, 720)
        .run(|_| Ok(GameState))

You can see this example in action by running cargo run --example hello_world.

The full list of examples is available here.


Tetra is fairly early in development, so you might run into bugs/flaky docs/general weirdness. Please feel free to open an issue/PR if you find something! You can also contact me via Twitter or the Rust Game Development Discord.


~506K SLoC