removed docs folder keeping versioned_docs
This commit is contained in:
@@ -1,43 +0,0 @@
|
||||
---
|
||||
title: Introduction
|
||||
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;
|
||||
|
||||
fn main() -> std::io::Result<()> {
|
||||
let mut screen = Screen::new();
|
||||
|
||||
screen.draw(format!("Hello, World!"));
|
||||
|
||||
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}};
|
||||
|
||||
fn main() -> std::io::Result<()> {
|
||||
let mut screen = Screen::new();
|
||||
screen.extension(VelocityExtension);
|
||||
|
||||
screen
|
||||
.draw(format!("Hello, World!"))
|
||||
.component(Velocity(100, 0)); // Velocity(x, y)
|
||||
|
||||
screen.run()
|
||||
}
|
||||
```
|
||||
@@ -1,27 +0,0 @@
|
||||
---
|
||||
title: Screen
|
||||
slug: /screen
|
||||
---
|
||||
`Screen` is a OSUI structure that allows the program to use osui elements and it's extensions.
|
||||
<img src="/img/diagrams/screen.png" alt="Diagram" width="600"/>
|
||||
|
||||
### `Screen::new()`
|
||||
Creates a new `Screen` structure with empty widgets and extensions.
|
||||
|
||||
### `draw(&mut self, element: E) -> &Arc<Widget>`
|
||||
Adds a element to the widgets array and returns the widget for extra parameters.
|
||||
|
||||
### `extension(&mut self, ext: E)`
|
||||
Adds a extension to the extensions array.
|
||||
|
||||
### `run(&mut self) -> std::io::Result<()>`
|
||||
Runs the app with the elements and extension provided.
|
||||
|
||||
### `render(&self) -> std::io::Result<()>`
|
||||
> :::warning
|
||||
> Do not run this function if you don't know what you're doing, this function may cause a mutex deadlock.
|
||||
|
||||
|
||||
### `render_extension(&self, wi: Arc<Widget>) -> std::io::Result<()>`
|
||||
> :::warning
|
||||
> Do not run this function if you don't know what you're doing, this function may cause a mutex deadlock.
|
||||
@@ -1,16 +0,0 @@
|
||||
---
|
||||
title: Extensions
|
||||
slug: /extensions
|
||||
---
|
||||
|
||||
OSUI Extensions are a practical way to extend the possibilities with OSUI, Extensions allow for there to be a specific use or functionality that may otherwise be bloat or the opposite behavior of the use case.
|
||||
|
||||
### `screen.extension(&mut self, ext: E)`
|
||||
You likely noticed that we used this function in the [Hello World App With Velocity](/docs/next/#hello-world-app-with-velocity) example, this function simply allows for structures implementing [Extension](/docs/next/extensions#trait-extension) to be included in the program.
|
||||
|
||||
## Trait `Extension`
|
||||
### `init(&self, _widgets: &Vec<Arc<Widget>>)`
|
||||
Runs right after the Transform component is applied to every widget.
|
||||
|
||||
### `render(&self, _widget: &Arc<Widget>)`
|
||||
Runs right before the `Element::render` is called.
|
||||
@@ -26,6 +26,7 @@ const config: Config = {
|
||||
docs: {
|
||||
sidebarPath: "./sidebars.json",
|
||||
editUrl: "https://github.com/osui-rs/docs/tree/master/",
|
||||
includeCurrentVersion: false,
|
||||
},
|
||||
blog: {
|
||||
showReadingTime: true,
|
||||
@@ -47,7 +48,7 @@ const config: Config = {
|
||||
|
||||
themeConfig: {
|
||||
colorMode: {
|
||||
defaultMode: 'dark',
|
||||
defaultMode: "dark",
|
||||
},
|
||||
navbar: {
|
||||
title: "OSUI",
|
||||
@@ -62,7 +63,7 @@ const config: Config = {
|
||||
position: "left",
|
||||
label: "Docs",
|
||||
},
|
||||
{to: '/blog', label: 'Blog', position: 'left'},
|
||||
{ to: "/blog", label: "Blog", position: "left" },
|
||||
{
|
||||
type: "docsVersionDropdown",
|
||||
position: "left",
|
||||
|
||||
Reference in New Issue
Block a user