#opengl #sdl2 #game-engine

d7engine

A game engine in rust with SDL2 and opengl

21 stable releases

1.1.5 Apr 1, 2023
1.1.4 Mar 19, 2023
1.1.3 Feb 26, 2023
1.0.12 Jan 31, 2023
1.0.5 Sep 26, 2022

#101 in Graphics APIs

MIT license

110KB
2.5K SLoC

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(),
    });
}

Dependencies

~42MB
~552K SLoC