14 releases
Uses old Rust 2015
0.2.0 | May 18, 2017 |
---|---|
0.1.1 | Aug 27, 2016 |
0.1.0 | Nov 28, 2015 |
0.0.12 | May 2, 2015 |
0.0.1 | Dec 15, 2014 |
#9 in #bold
43 downloads per month
22KB
484 lines
termbox-rs: High level Rust bindings for Termbox.
Copyright (c) 2015, daggerbot@gmail.com This software is available under the terms of the zlib license. See COPYING.TXT for more information.
The original Termbox library is available under the terms of the MIT license.
lib.rs
:
Termbox is a simple library for writing text based user interfaces. It was originally written in C, and this binding was not written by the original author.
Example
extern crate termbox;
use termbox::{
Termbox,
Event,
BLACK,
WHITE,
BOLD,
KEY_ESC,
};
fn main () {
// Open the terminal
let mut tb = Termbox::open().unwrap();
// Clear the screen to black
tb.set_clear_attributes(BLACK, BLACK);
tb.clear();
// Display a message
tb.put_str(0, 0, "Hello, world!", WHITE | BOLD, BLACK);
tb.put_str(0, 1, "Press Esc to continue", WHITE, BLACK);
tb.present();
// Wait for the user to press Esc
loop {
match tb.poll_event() {
Event::Key(event) => {
if event.key == KEY_ESC {
break;
}
},
_ => {},
}
}
}
Dependencies
~24KB