wobl

Crates.iowobl
lib.rswobl
version0.1.1
created_at2025-08-22 17:05:36.016074+00
updated_at2025-08-22 19:33:18.801498+00
descriptionmultibackend textbased game engine
homepage
repositoryhttps://github.com/dvdtsb/wobl
max_upload_size
id1806635
size527,293
Tache David Stefan (DVDTSB)

documentation

README

wobl

multi-backend textbased game engine :)

use

use wobl::{Attribute, Color, Key, Wobl, backend::CrosstermBackend};

fn main() {
    let backend = Box::new(CrosstermBackend::new());
    let mut engine = Wobl::new(backend, 60, 30, Some(60));

    loop {
        engine.wait_frame();

        engine.clear();

        if engine.is_key_pressed(Key::Q) {
            break;
        }
        engine.draw_text_atr(
            10,
            10,
            "hello wobl!",
            Color::Black,
            Color::White,
            &vec![Attribute::Italic, Attribute::Bold],
        );
    }
}

backends

backends are quite straight forward to implement. here are the included ones!

  • crossterm (woah terminal!): this should work pretty much everywhere: windows, linux (x11) and macos. if feature crossterm_events is enabled then it uses terminal events (kitty protocol), otherwise it uses device_query - enable it if using wayland (add --features crossterm_events)!
  • sdl: for now - it just kinda works - i can definetly make more optimizations (like a texture atlas)

boilerplate can differ slightly from backend to backend, but only a couple of lines of code :)

  • crossterm:
    let backend = Box::new(CrosstermBackend::new());
    let mut engine = Wobl::new(backend, 50, 25, Some(60));

-sdl:

    let sdl_context = sdl2::init().unwrap();
    let ttf_context: &Sdl2TtfContext = Box::leak(Box::new(sdl2::ttf::init().unwrap()));

    let backend = Box::new(SDLBackend::new(
        30,
        "resources/font.ttf",
        ttf_context,
        sdl_context,
    ));

    let mut wobl = Wobl::new(backend, "Colorful Wobl Demo", 50, 25, Some(60));
    loop {...}

to do

  • [] add more utilities:
    • [] line drawing
    • [] box drawing
    • [] autotile
  • [] use font atlas thing in sdl
  • [] maybe winit and wgpu backend
Commit count: 6

cargo fmt