#opengl #sdl2 #framework #graphics #sdl #rendering-engine

cafe_core

Game frameworks made on top of SDL2 and OpenGL

3 releases

Uses old Rust 2015

0.1.2 Sep 5, 2023
0.1.1 Sep 4, 2023
0.1.0 Sep 3, 2023

#159 in Rendering

MIT license

2MB
1.5K SLoC

Cafe

Cafe is game engine/framework, build on top of independent modules:

  • Tea for render
  • Mocha for audio
  • Coffee for scripting (Rust port is a WIP)
  • Latte for filesystem and package (Rust port is a WIP)

The other modules i don't started even in C, so i'll start from scratch in Rust:

  • Milk for UI
  • Cybercafe editor

Example code:

extern crate cafe;

use cafe::{Game, CafeBuilder, Render};
use cafe::render::render2D::Render2D;

pub struct MyGame {}

impl Game for MyGame {
    type Render = Render2D;

    fn new() -> Self {
        MyGame {}
    }

    fn setup(&mut self, _settings: &mut GameSettings) {}
    fn run(&mut self, _dt: f32, render: &mut Self::Render) -> bool {
        render.begin();
        render.clear();
        render.end();
        true
    }
}

fn main() {
    let cafe = CafeBuilder::new("Hello Game", 640, 380)
        .resizable(true)
        .build::<MyGame>()
        .unwrap();
    cafe.run();
}

Dependencies

~19MB
~362K SLoC