33 releases (9 stable)

1.0.8 Mar 10, 2021
1.0.7 Mar 7, 2021
1.0.5 Feb 28, 2021
0.1.24 Feb 7, 2021
0.1.9 Oct 28, 2020

#41 in GUI

Download history 68/week @ 2021-04-02 8/week @ 2021-04-09 132/week @ 2021-04-16 56/week @ 2021-04-23 42/week @ 2021-04-30 2/week @ 2021-05-07 38/week @ 2021-05-14 2/week @ 2021-05-21 4/week @ 2021-05-28 2/week @ 2021-06-04 69/week @ 2021-06-11 2/week @ 2021-06-18 3/week @ 2021-06-25 3/week @ 2021-07-02 2/week @ 2021-07-09 37/week @ 2021-07-16

244 downloads per month
Used in sbyte

GPL-2.0-or-later

120KB
2.5K SLoC

Wrecked

A library for terminal-based graphics and UI.
Travis (.com) Crates.io Crates.io GitHub

About

Wrecked is (hopefully) a straightforward environment for rendering character-based graphics that uses a tree-like structure with rectangles as nodes. It exists partially because I wanted to give myself a reason to work in rust, but mostly because I didn't want to read through the ncurses documentation.

Setup

The latest stable version can be found at crates.io. In your project's Cargo.toml...

[dependencies]
wrecked = "^1.0.0"

Usage

use wrecked::{RectManager, RectColor};
use std::{time, thread};

// Instantiates the environment. Turns off input echo.
let mut rectmanager = RectManager::new();

// create a rectangle to put text in.
let mut rect_id = rectmanager.new_rect(wrecked::TOP).ok().unwrap();

// set the new rectangle's size
rectmanager.resize(rect_id, 16, 5);

// Add a string to the center of the rectangle
rectmanager.set_string(rect_id, 2, 3, "Hello World!");

// Make that rectangle blue
rectmanager.set_bg_color(rect_id, RectColor::BLUE);

// And finally underline the text of the rectangle
rectmanager.set_underline_flag(rect_id);

// Draw the environment
rectmanager.render();

// Sleep for 2 seconds so you can see the output before it gets torn down
thread::sleep(time::Duration::from_secs(2));

// take down the environment, and turn echo back on.
rectmanager.kill();

Dependencies

~105KB