Crates.io | tge |
lib.rs | tge |
version | 0.0.4 |
source | src |
created_at | 2019-02-01 13:22:52.850056 |
updated_at | 2021-10-20 09:34:36.458702 |
description | A lightweight cross-platform 2D game framework written in pure Rust and based on OpenGL 3.3+. |
homepage | |
repository | https://github.com/TakWolf/tge |
max_upload_size | |
id | 111982 |
size | 248,848 |
A lightweight cross-platform 2D game framework written in pure Rust and based on OpenGL 3.3+.
Inspired by LÖVE.
Tge is currently in a very early stage of development. The API may be changed. Until the version to 0.1.0
.
The following does not contain, but can easily work with other crates:
Add the dependency line to your Cargo.toml
file:
[dependencies]
tge = "0.0.4"
To release performance, also add the following configs:
[profile.dev]
opt-level = 3
Then create a basic template. Here is the minimal example that will create a window:
use tge::prelude::*;
struct App {}
impl App {
fn new(_: &mut Engine) -> GameResult<Self> {
// load assets
Ok(Self {})
}
}
impl Game for App {
fn update(&mut self, _: &mut Engine) -> GameResult {
// handle logic
Ok(())
}
fn render(&mut self, engine: &mut Engine) -> GameResult {
engine.graphics().clear(Color::BLUE);
// draw sprites
Ok(())
}
}
fn main() -> GameResult {
let mut engine = EngineBuilder::new()
.window_config(WindowConfig::new()
.title("My Game")
.inner_size((1024.0, 600.0)))
.build()?;
let mut app = App::new(&mut engine)?;
engine.run(&mut app)
}
That is!
You can also see the examples/
directory to learn other examples.
See the example bunny_mark
and hare_mark
.
The following is working in progress:
MIT OR Apache-2.0