readme changes

This commit is contained in:
2024-11-19 14:56:40 +01:00
parent f3a376d418
commit 2342a923e3
5 changed files with 16 additions and 52 deletions
+11 -39
View File
@@ -1,9 +1,15 @@
# OSUI - A Terminal User Interface (TUI) Library
OSUI is a customizable terminal user interface (TUI) library written in Rust. It provides a set of components to build interactive command-line interfaces with ease.
<div style="text-align:center">
<img src="github/OSUI.png" alt="OSUI" width="200px"/>
<br/>
<b>OSUI is a customizable terminal user interface (TUI) library written in Rust. It provides a set of components and rsx to build interactive command-line interfaces with ease.
</b>
</div>
## Features
- Custom rsx syntax.
- Define and manage UI components.
- Handle keyboard input seamlessly.
- Create complex layouts using nested elements.
@@ -23,7 +29,7 @@ osui = "0.2" # Replace with the latest version
Here’s a simple example of how to create a basic UI with OSUI:
```rust
use osui::{rsx, app::run, ui::*};
use osui::prelude::*;
fn main() {
run(&mut rsx! {
@@ -32,43 +38,9 @@ fn main() {
}
```
## Modules
- **element**: Defines base elements and their behavior.
- **key**: Handles keyboard input and mapping.
- **utils**: Provides utility functions for common TUI tasks.
- **ui**: Contains user interface components and layout management.
## Elements
### ElementSize
Defines the size of an element, either as a default size or a custom size.
### Element Trait
The core trait for all UI components, requiring the implementation of methods to retrieve data, update dimensions, render output, and handle updates based on user input.
### Commands
The library supports several commands that can be triggered during the application’s lifecycle:
- **Render**: Re-render an element with the given state.
- **Update**: Update an element's state based on user input.
- **Sleep**: Pause execution for a specified duration.
- **Exit**: Terminate the application gracefully.
## Macros
OSUI provides several macros to simplify the definition and usage of elements:
- **element!**: Define a new UI element with customizable properties and behaviors.
- **rsx!**: Create a nested structure of UI components easily.
- **command!**: Simplify command creation for updates.
## Credits
Credit to priz.js (discord) for the idea of using C
## How it works
Credit to priz.js (discord) for the idea of using C for multithreading
<img src="github/multithread.png"/>
## Contributing