This commit is contained in:
2025-06-30 22:19:19 +02:00
parent 915dabe9e2
commit e409d7153c
7 changed files with 129 additions and 2 deletions
+31
View File
@@ -0,0 +1,31 @@
---
title: OSUI v0.0.9 alpha, what's new and should you update
description: OSUI v0.0.9 is just on the edge of development, alpha is just the beginning.
slug: osui-0.0.9-alpha
authors:
- kleo-dev
---
Greetings to everyone, i haven't been working on OSUI for the past 6 months, i have been busy with other projects and haven't found myself motivated enough for OSUI, now i'm ready to go back to OSUI and make major changes.
## ⚡️ Changes
- ⚙️ Rewrite the entire codebase
- ⚙️ OSUI engine is now OSUI itself, frontend parts like `rsx!` and `css` will be included in future versions with more advanced features.
- 📌 Modularity and reliability improvements, due to the new design we now have a dramatic increase in reliability and modularity
## ⚛️ OSUI Components and extensions
OSUI Components and Extensions are a important design choice for OSUI, They store specific data to a element that a Extension can use for a specific purpose.
### Extensions
A OSUI extension extends the functionality of the current elements and program, a good example is in our [Hello World App With Velocity](/docs/#hello-world-app-with-velocity) example, where we use the built in `VelocityExtension` as well as the `Velocity(x, y)` component, by design it is required for a extension to have the components be optional for the elements, unless there is a very specific reason not to make it optional.
### Components
A OSUI component is simply data that a extension or the default OSUI runtime may find useful, A good example is `Transform` which like the name suggests, it transforms the element into it's parameters
## Conclusion
While we have exciting changes on the way, we are far from done and we need support from everyone reading this, thank you for reading it, if you'd like to support us and our projects please star our GitHub repository and follow our github Org for the latest updates.
+2 -2
View File
@@ -1,7 +1,7 @@
--- ---
title: Releasing OSUI v0.0.9 title: Releasing OSUI v0.0.9
description: A new upcoming version of OSUI will come out. Let's re-write it. description: A new upcoming version of OSUI will come out. Let's re-write it.
slug: welcome-docusaurus-v2 slug: osui-0.0.9-rewrite
authors: authors:
- kleo-dev - kleo-dev
--- ---
@@ -13,7 +13,7 @@ OSUI v0.0.9 Comes with a engine that works under the hood and can be manipulated
- Game engine - Game engine
- Fluid simulation - Fluid simulation
- Velocity - Velocity
This may seem like a gimmick but it's essential to provide features only when needed and prioritize performance to extend reliability. [Read more](/docs/next/engine) This may seem like a gimmick but it's essential to provide features only when needed and prioritize performance to extend reliability. [Read more](/docs/0.0.8/engine)
## ⚡️ Improvements ## ⚡️ Improvements
- 📌 Reliable - 📌 Reliable
+43
View File
@@ -0,0 +1,43 @@
---
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()
}
```
+27
View File
@@ -0,0 +1,27 @@
---
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.
@@ -0,0 +1,16 @@
---
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.
@@ -0,0 +1,8 @@
{
"docsSidebar": [
{
"type": "autogenerated",
"dirName": "."
}
]
}
+2
View File
@@ -1,3 +1,5 @@
[ [
"0.0.9",
"0.0.8",
"0.0.7" "0.0.7"
] ]