
Dreg
A simple text-based user interface library that will run on just about anything.
Examples
Terminal
use dreg::prelude::*;
fn main() -> Result<()> {
let program = MyProgram {
should_quit: false,
};
let platform = CrosstermPlatform::new()?;
run_program(program, platform)?;
Ok(())
}
struct MyProgram {
should_quit: bool,
}
impl Program for MyProgram {
fn update(&mut self, frame: Frame) {
if frame.context.keys_down().contains(&Scancode::Q) {
self.should_quit = true;
return; }
frame.buffer.set_string(
1, 1, format!("KEYS DOWN: {:?}", frame.context.keys_down()),
Style::new(), );
}
fn should_exit(&self) -> bool {
self.should_quit
}
}
Overview
Design Philosophy
The design of Dreg has been radical simplicity from the very start.
Features
Limitations
- No support for variable width fonts; even on platforms that do support them.
Acknowledgments
License
MIT
[^1]: It's not gonna run on your toaster, but it might run on your smart fridge.