we frikin did it bois

gui library works frrr

implementation:
- containers now store a Widget type.

- every widget has a unique id

- there is a data store that maps the id to the internally stored gui component.

- the compoenents can be fetched from the datastore using their Widget type
- the datastore uses a hashmap so fetching shouldnt have any real performance penalty.

- widgets can be fetched, inserted, updated and rendered from the datastore

- the render method can be called directly from the Widget type without having to know the underlying type that it references
This commit is contained in:
FantasyPvP
2023-11-27 19:02:32 +00:00
parent 417833fc41
commit f48eb133b3
5 changed files with 256 additions and 71 deletions
+4
View File
@@ -1,5 +1,6 @@
use alloc::string::String;
use alloc::vec::Vec;
use core::any::Any;
use crate::std::frame::{ColouredChar, Dimensions, Frame, Position, RenderError};
use crate::user::lib::libgui::cg_core::{CgComponent, CgTextEdit};
@@ -56,6 +57,9 @@ impl CgComponent for CgLineEdit {
Ok(frame)
}
fn as_any(&self) -> &dyn Any {
self
}
}
impl CgTextEdit for CgLineEdit {