Crates.io | d7engine |
lib.rs | d7engine |
version | 1.1.5 |
source | src |
created_at | 2022-09-25 21:12:24.43112 |
updated_at | 2023-04-01 12:06:01.37145 |
description | A game engine in rust with SDL2 and opengl. |
homepage | |
repository | https://github.com/debugseven/d7engine |
max_upload_size | |
id | 673820 |
size | 109,667 |
Make sure that you have Rust installed on your pc by using:
cargo version
or install Rust by using the official Rust installation guid.
Create a new project:
cargo new your_game_name
And add the engine to the project:
cd your_game_name
cargo add d7engine
//#![windows_subsystem = "windows"]
use d7engine::*;
struct Runt {
components: ComponentContainer,
camera: Transform,
}
impl Runtime for Runt {
fn load(&mut self) {
let color = Color::rgb(255, 0, 0);
let mut rect1 = Component::rect().unwrap();
rect1.set_color(&color);
rect1.set_dim(100.0, 100.0);
rect1.transform.set(50.0, 50.0, 0.0);
self.components.insert("1", rect1);
}
fn draw(&mut self, draw: &Draw) {
self.components.draw(draw, &self.camera).unwrap();
}
}
fn main() {
init(Config::default(), &mut Runt{
components: ComponentContainer::new(),
camera: Transform::new(),
});
}