d7engine

Crates.iod7engine
lib.rsd7engine
version1.1.5
sourcesrc
created_at2022-09-25 21:12:24.43112
updated_at2023-04-01 12:06:01.37145
descriptionA game engine in rust with SDL2 and opengl.
homepage
repositoryhttps://github.com/debugseven/d7engine
max_upload_size
id673820
size109,667
Markus Dick (debugseven)

documentation

https://docs.rs/d7engine

README

d7engine

A project by Markus Dick

d7engine is a homemade games engine for fun.

Installation

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

Basic setup:

//#![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(),
    });
}
Commit count: 154

cargo fmt