From de7c83adbc0c32b48f8e1390714dae0c9f6a3f0a Mon Sep 17 00:00:00 2001 From: griffi-gh Date: Thu, 23 Nov 2023 17:59:14 +0100 Subject: [PATCH] wip texture managment --- Cargo.lock | 7 +++++++ kubi-ui/Cargo.toml | 6 ++++-- kubi-ui/src/lib.rs | 3 +++ kubi-ui/src/texman.rs | 3 +++ 4 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 kubi-ui/src/texman.rs diff --git a/Cargo.lock b/Cargo.lock index 7ca11d9..dd6ec0c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1056,6 +1056,7 @@ dependencies = [ "kubi-logging", "log", "nohash-hasher", + "rect_packer", "winit", ] @@ -1579,6 +1580,12 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "rect_packer" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8ffb4dfda4b01cc420847665dc480760d596ce186f2772a66ed32fe9acb1c45" + [[package]] name = "redox_syscall" version = "0.3.5" diff --git a/kubi-ui/Cargo.toml b/kubi-ui/Cargo.toml index d069586..aded733 100644 --- a/kubi-ui/Cargo.toml +++ b/kubi-ui/Cargo.toml @@ -10,6 +10,7 @@ nohash-hasher = "0.2" glam = { version = "0.24", features = ["approx"] } glium = { git = "https://github.com/glium/glium", rev = "968fc92378caf", optional = true } fontdue = { version = "0.7", optional = true } +rect_packer = { version = "0.2.1", optional = true } log = "0.4" [dev-dependencies] @@ -18,8 +19,9 @@ glium = { git = "https://github.com/glium/glium", rev = "968fc92378caf" } winit = "0.29" [features] -default = ["builtin_elements", "text_rendering", "builtin_font", "backend_glium"] +default = ["builtin_elements", "texture_manager", "text_rendering", "builtin_font", "backend_glium"] backend_glium = ["dep:glium"] -text_rendering = ["dep:fontdue"] +texture_manager = [] +text_rendering = ["dep:fontdue", "texture_manager"] builtin_font = ["text_rendering"] builtin_elements = [] diff --git a/kubi-ui/src/lib.rs b/kubi-ui/src/lib.rs index 04da735..c600b69 100644 --- a/kubi-ui/src/lib.rs +++ b/kubi-ui/src/lib.rs @@ -7,7 +7,10 @@ pub mod draw; pub mod backend; pub mod measure; pub mod state; +#[cfg(feature = "text_rendering")] pub mod font; +#[cfg(feature = "texture_manager")] +pub mod texman; use element::UiElement; use state::StateRepo; diff --git a/kubi-ui/src/texman.rs b/kubi-ui/src/texman.rs new file mode 100644 index 0000000..69761a2 --- /dev/null +++ b/kubi-ui/src/texman.rs @@ -0,0 +1,3 @@ +struct TextureSpace { + +}