Description
Tetra is a simple 2D game framework written in Rust. It uses SDL2 for event handling and OpenGL 3.2+ for rendering.
Tetra alternatives and similar packages
Based on the "Game development" category.
Alternatively, view Tetra alternatives based on common mentions on social networks and blogs.
-
RG3D
3D and 2D game engine written in Rust [Moved to: https://github.com/FyroxEngine/Fyrox] -
RustAllegro
A Rust wrapper and bindings of Allegro 5 game programming library -
specs-blit
๐คนโ 2D sprite rendering extension for the specs ECS system
ONLYOFFICE Docs โ document collaboration in your environment
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of Tetra or a related project?
Popular Comparisons
README
Tetra
Tetra is a simple 2D game framework written in Rust. It uses SDL2 for event handling and OpenGL 3.2+ for rendering.
Status
Tetra is no longer being actively developed, as of January 2022. Bug fixes and dependency updates may still happen from time to time, but no new features are planned. Feature PRs may be accepted, as long as they do not come with a large maintainence burden - please open an issue/discussion thread if you're thinking about making any large changes!
For more information, see this blog post.
Features
- 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
Installation
To add Tetra to your project, add the following line to your Cargo.toml
file:
tetra = "0.7"
You will also need to install the SDL2 native libraries - full details are provided in the documentation.
Examples
To get a simple window displayed on screen, the following code can be used:
```rust ,noplaypen 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](https://tetra.seventeencups.net/examples).
## Support/Feedback
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](https://twitter.com/17cupsofcoffee) or the [Rust Game Development Discord](https://discord.gg/yNtPTb2).
*Note that all licence references and agreements mentioned in the Tetra README section above
are relevant to that project's source code only.