updated v0.0.9 docs

This commit is contained in:
2025-07-30 17:48:38 +02:00
parent e409d7153c
commit 4f9999b908
5 changed files with 182 additions and 24 deletions
+18 -10
View File
@@ -2,26 +2,34 @@
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()`
### `Screen::new() -> Arc<Screen>`
Creates a new `Screen` structure with empty widgets and extensions.
### `draw(&mut self, element: E) -> &Arc<Widget>`
### `draw(self: &Arc<Self>, element: FnMut() -> WidgetLoad) -> 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.
### `extension(&mut self, ext: Extension)`
Implements a extension to the screen.
### `run(&mut self) -> std::io::Result<()>`
Runs the app with the elements and extension provided.
Runs the app.
### `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.
> Do not call this function if you don't know what you're doing, this function may cause a mutex deadlock.
### `pub fn draw_box(self: &Arc<Self>, element: Box<dyn FnMut() -> WidgetLoad + Send + Sync>) -> Arc<Widget>`
Adds a element to the widgets array and returns the widget for extra parameters.
> :::info
> This function is useful in special scenarios.