🎮 A simple 2D game framework written in Rust
Rust
1,010
1,049 commits
updated Jul 22, 2026
Tetra is a simple 2D game framework written in Rust. It uses SDL for event handling and OpenGL 3.2+ for rendering.
Tetra is being passively maintained, as of January 2022.
No new features are planned, but occasional bugfix updates may still be released from time to time. PRs may be accepted if they don't have a large maintainence burden.
If you're looking for a similar framework that's more actively developed, try macroquad or GGEZ. Alternatively, you can try nova, my spiritual successor to this library (much smaller scope, still very experimental).
To add Tetra to your project, add the following line to your Cargo.toml file:
tetra = "0.9"
You will also need to install the SDL native libraries - full details are provided in the documentation.
To get a simple window displayed on screen, the following code can be used:
use tetra::graphics::{self, Color};
use tetra::{Context, ContextBuilder, State};
struct GameState;
impl State for GameState {
fn draw(&mut self, ctx: &mut Context) -> tetra::Result {
// Cornflower blue, as is tradition
graphics::clear(ctx, Color::rgb(0.392, 0.584, 0.929));
Ok(())
}
}
fn main() -> tetra::Result {
ContextBuilder::new("Hello, world!", 1280, 720)
.build()?
.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.
Overall
Maintained
Code review
crates.io
Latest release
Releases this year
731 followers · starred Jan 2020
673 followers · starred Feb 2020
567 followers · starred Sep 2025
427 followers · starred Dec 2020
🎮 A simple 2D game framework written in Rust
Rust
1,010
1,049 commits
updated Jul 22, 2026
Tetra is a simple 2D game framework written in Rust. It uses SDL for event handling and OpenGL 3.2+ for rendering.
Tetra is being passively maintained, as of January 2022.
No new features are planned, but occasional bugfix updates may still be released from time to time. PRs may be accepted if they don't have a large maintainence burden.
If you're looking for a similar framework that's more actively developed, try macroquad or GGEZ. Alternatively, you can try nova, my spiritual successor to this library (much smaller scope, still very experimental).
To add Tetra to your project, add the following line to your Cargo.toml file:
tetra = "0.9"
You will also need to install the SDL native libraries - full details are provided in the documentation.
To get a simple window displayed on screen, the following code can be used:
use tetra::graphics::{self, Color};
use tetra::{Context, ContextBuilder, State};
struct GameState;
impl State for GameState {
fn draw(&mut self, ctx: &mut Context) -> tetra::Result {
// Cornflower blue, as is tradition
graphics::clear(ctx, Color::rgb(0.392, 0.584, 0.929));
Ok(())
}
}
fn main() -> tetra::Result {
ContextBuilder::new("Hello, world!", 1280, 720)
.build()?
.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.
Overall
Maintained
Code review
crates.io
Latest release
Releases this year
731 followers · starred Jan 2020
673 followers · starred Feb 2020
567 followers · starred Sep 2025
427 followers · starred Dec 2020