add short READMEs for examples

This commit is contained in:
Michael Sippel 2024-03-21 18:17:04 +01:00
parent 33e97ed5e3
commit 473dd5f4dc
Signed by: senvas
GPG key ID: F96CF119C34B64A6
6 changed files with 51 additions and 4 deletions

View file

@ -0,0 +1,8 @@
# tty-01-hello
This example shows how to:
- initialize the TTY backend (`lib-nestetd-tty`),
- create a simple 'Hello World' output,
- create color gradients on the outputted text
utilizing basic projection functionality from `lib-r3vi`,
- perform basic layouting & compositing.

View file

@ -1,3 +1,10 @@
//! This example shows how to:
//! - initialize the TTY backend (`lib-nestetd-tty`),
//! - create a simple 'Hello World' output,
//! - create color gradients on the outputted text
//! utilizing basic projection functionality from `lib-r3vi`,
//! - perform basic layouting & compositing.
extern crate cgmath;
extern crate nested;
extern crate nested_tty;
@ -15,19 +22,29 @@ use {
#[async_std::main]
async fn main() {
/* initialize our terminal
/* Initialize our terminal.
*/
let tty_app = TTYApplication::new(|event| { /* handle event */ });
/* populate the view in `term_port`
/* Setup our "root" view of the application.
* This will be the compositor, which is able to
* mix multiple `TerminalView`-Views together.
* Its output is routed to the `app.port` Viewport,
* so it will be displayed on TTY-output.
*/
let compositor = TerminalCompositor::new(tty_app.port.inner());
/* Add the label 'test' at position (7, 2)
*/
compositor
.write()
.unwrap()
.push(nested_tty::make_label("test").offset(Vector2::new(7, 2)));
/* Add a 'Hello World' label at position (5, 3)
* and set a coloring determined by formula from
* the position of each character.
*/
compositor.write().unwrap().push(
nested_tty::make_label("Hello World")
.map_item(|p, a| {
@ -36,7 +53,7 @@ async fn main() {
.offset(Vector2::new(5, 3)),
);
/* write the changes in the view of `term_port` to the terminal
/* write the changes in the root-view to the terminal
*/
tty_app.show().await.expect("output error!");
}

View file

@ -0,0 +1,4 @@
# tty-02-digit
This example demonstrates how a very simple editor for hexadecimal digits
can be created with `lib-nested` and the `lib-nested-tty` backend.

View file

@ -1,3 +1,6 @@
//! This example demonstrates how a very simple editor for hexadecimal digits
//! can be created with `lib-nested` and the `lib-nested-tty` backend.
extern crate cgmath;
extern crate nested;
extern crate nested_tty;

View file

@ -0,0 +1,8 @@
# tty-03-string
Similarly to `tty-02-digit`, a editor is created
but of type <List Char>.
The contents of the editor can be retrieved by
a morphism from the `EditTree` node.
To demonstrate that, the values are are mapped
to the TTY-display in different form.

View file

@ -1,3 +1,10 @@
//! Similarly to `tty-02-digit`, a editor is created
//! but of type <List Char>.
//! The contents of the editor can be retrieved by
//! a morphism from the `EditTree` node.
//! To demonstrate that, the values are are mapped
//! to the TTY-display in different form.
extern crate cgmath;
extern crate nested;
extern crate nested_tty;