17 releases

new 0.1.17 Jan 11, 2021
0.1.16 Jan 11, 2021
0.1.12 Nov 30, 2020
0.1.9 Oct 28, 2020

#74 in GUI

Download history 46/week @ 2020-10-08 52/week @ 2020-10-15 55/week @ 2020-10-22 34/week @ 2020-10-29 41/week @ 2020-11-05 18/week @ 2020-11-12 16/week @ 2020-11-19 29/week @ 2020-11-26 28/week @ 2020-12-03 14/week @ 2020-12-10 21/week @ 2020-12-17 36/week @ 2020-12-31 71/week @ 2021-01-07

124 downloads per month
Used in sbyte

GPL-2.0-or-later

115KB
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 = { version ="*" }

Usage

use wrecked::{RectManager, RectColor};

// 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);

// 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.draw();

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

Dependencies

~100KB