updated v0.0.9 docs
This commit is contained in:
@@ -6,37 +6,47 @@ slug: /
|
||||
OSUI is a powerful TUI library, what makes it special is it's design and features, it allows for both customization and easy of use.
|
||||
|
||||
### Setup
|
||||
|
||||
First, you need to install osui to a already existing [rust cargo](https://doc.rust-lang.org/cargo/getting-started/index.html) project, then in your project directory run:
|
||||
|
||||
```bash
|
||||
cargo add osui
|
||||
```
|
||||
|
||||
## Hello World App
|
||||
To make a hello world app in OSUI simply write this
|
||||
|
||||
```rust src/main.rs
|
||||
use osui::Screen;
|
||||
use osui::prelude::*;
|
||||
|
||||
fn main() -> std::io::Result<()> {
|
||||
let mut screen = Screen::new();
|
||||
|
||||
screen.draw(format!("Hello, World!"));
|
||||
let screen = Screen::new();
|
||||
|
||||
rsx! {
|
||||
"Hello, World"
|
||||
}
|
||||
.draw(&screen);
|
||||
|
||||
screen.run()
|
||||
}
|
||||
```
|
||||
|
||||
## Hello World App With Velocity
|
||||
|
||||
The text will move from left to right with a velocity of `100`
|
||||
|
||||
```rust src/main.rs
|
||||
use osui::{Screen, extensions::velocity::{VelocityExtension, Velocity}};
|
||||
use osui::prelude::*;
|
||||
|
||||
fn main() -> std::io::Result<()> {
|
||||
let mut screen = Screen::new();
|
||||
let screen = Screen::new();
|
||||
screen.extension(VelocityExtension);
|
||||
|
||||
screen
|
||||
.draw(format!("Hello, World!"))
|
||||
.component(Velocity(100, 0)); // Velocity(x, y)
|
||||
|
||||
rsx! {
|
||||
@Velocity(100, 0);
|
||||
@Transform::new();
|
||||
"Hello, World"
|
||||
}
|
||||
.draw(&screen);
|
||||
|
||||
screen.run()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user