Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Rust implementation of the termbox library

License

NotificationsYou must be signed in to change notification settings

gchp/rustbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rustbox is a Rust implementation oftermbox.

Currently, this is just a wrapper of the C library by nsf, though my plan is to convert it to be a pure Rust implementation and remove the requirement on the C library.

The original implementation of this was inspired byAaron Pribadi, so big props to him for the original work.

NOTE This is under development, and the APIs may change as I figure out more how Rust works and as the language itself changes

Documentation

Usage

In yourCargo.toml add the following:

[dependencies]rustbox ="*"

You can also use the current git version by instead adding:

[dependencies.rustbox]git ="https://github.com/gchp/rustbox.git"

Then, in yoursrc/example.rs:

externcrate rustbox;use std::error::Error;use std::default::Default;use rustbox::{Color,RustBox};use rustbox::Key;fnmain(){let rustbox =matchRustBox::init(Default::default()){Result::Ok(v) => v,Result::Err(e) =>panic!("{}", e),};    rustbox.print(1,1, rustbox::RB_BOLD,Color::White,Color::Black,"Hello, world!");    rustbox.print(1,3, rustbox::RB_BOLD,Color::White,Color::Black,"Press 'q' to quit.");    rustbox.present();loop{match rustbox.poll_event(false){Ok(rustbox::Event::KeyEvent(key)) =>{match key{Key::Char('q') =>{break;}                    _ =>{}}},Err(e) =>panic!("{}", e.description()),            _ =>{}}}}

NOTE: this example can also be run withcargo run --example hello-world.

Projects that use this crate:

About

Rust implementation of the termbox library

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors28

Languages


[8]ページ先頭

©2009-2025 Movatter.jp