| Crates.io | wobl |
| lib.rs | wobl |
| version | 0.1.1 |
| created_at | 2025-08-22 17:05:36.016074+00 |
| updated_at | 2025-08-22 19:33:18.801498+00 |
| description | multibackend textbased game engine |
| homepage | |
| repository | https://github.com/dvdtsb/wobl |
| max_upload_size | |
| id | 1806635 |
| size | 527,293 |
multi-backend textbased game engine :)
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 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 {...}
sdlwinit and wgpu backend