removed the next thingy
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.
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import { themes as prismThemes } from "prism-react-renderer";
|
import { themes as prismThemes } from "prism-react-renderer";
|
||||||
import type { Config } from "@docusaurus/types";
|
import type { Config } from "@docusaurus/types";
|
||||||
import type * as Preset from "@docusaurus/preset-classic";
|
import type * as Preset from "@docusaurus/preset-classic";
|
||||||
|
import * as versions from './versions.json';
|
||||||
|
|
||||||
const config: Config = {
|
const config: Config = {
|
||||||
title: "OSUI",
|
title: "OSUI",
|
||||||
@@ -26,6 +27,8 @@ const config: Config = {
|
|||||||
docs: {
|
docs: {
|
||||||
sidebarPath: "./sidebars.json",
|
sidebarPath: "./sidebars.json",
|
||||||
editUrl: "https://github.com/osui-rs/docs/tree/master/",
|
editUrl: "https://github.com/osui-rs/docs/tree/master/",
|
||||||
|
path: 'versioned_docs/version-0.1.0',
|
||||||
|
onlyIncludeVersions: (versions as any).default.filter((v) => v !== 'next'),
|
||||||
},
|
},
|
||||||
blog: {
|
blog: {
|
||||||
showReadingTime: true,
|
showReadingTime: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user