diff --git a/blog/new-design.md b/blog/new-design.md new file mode 100644 index 0000000..3b4541e --- /dev/null +++ b/blog/new-design.md @@ -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. diff --git a/blog/osui-rewrite.md b/blog/osui-rewrite.md index 0305cf4..f279a0d 100644 --- a/blog/osui-rewrite.md +++ b/blog/osui-rewrite.md @@ -1,7 +1,7 @@ --- title: Releasing OSUI v0.0.9 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: - 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 - Fluid simulation - 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 - 📌 Reliable diff --git a/versioned_docs/version-0.0.9/a_index.md b/versioned_docs/version-0.0.9/a_index.md new file mode 100644 index 0000000..ec56237 --- /dev/null +++ b/versioned_docs/version-0.0.9/a_index.md @@ -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() +} +``` diff --git a/versioned_docs/version-0.0.9/b_screen.md b/versioned_docs/version-0.0.9/b_screen.md new file mode 100644 index 0000000..ad23e8e --- /dev/null +++ b/versioned_docs/version-0.0.9/b_screen.md @@ -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. +Diagram + +### `Screen::new()` +Creates a new `Screen` structure with empty widgets and extensions. + +### `draw(&mut self, element: E) -> &Arc` +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) -> 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. \ No newline at end of file diff --git a/versioned_docs/version-0.0.9/c_extensions.md b/versioned_docs/version-0.0.9/c_extensions.md new file mode 100644 index 0000000..96fa9a9 --- /dev/null +++ b/versioned_docs/version-0.0.9/c_extensions.md @@ -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>)` +Runs right after the Transform component is applied to every widget. + +### `render(&self, _widget: &Arc)` +Runs right before the `Element::render` is called. diff --git a/versioned_sidebars/version-0.0.9-sidebars.json b/versioned_sidebars/version-0.0.9-sidebars.json new file mode 100644 index 0000000..39332bf --- /dev/null +++ b/versioned_sidebars/version-0.0.9-sidebars.json @@ -0,0 +1,8 @@ +{ + "docsSidebar": [ + { + "type": "autogenerated", + "dirName": "." + } + ] +} diff --git a/versions.json b/versions.json index b20af12..e421259 100644 --- a/versions.json +++ b/versions.json @@ -1,3 +1,5 @@ [ + "0.0.9", + "0.0.8", "0.0.7" ]