diff --git a/kubi-ui/src/draw.rs b/kubi-ui/src/draw.rs index 43fe038..68d62ca 100644 --- a/kubi-ui/src/draw.rs +++ b/kubi-ui/src/draw.rs @@ -1,4 +1,4 @@ -use crate::IfModified; +use crate::{IfModified, text::TextRenderer}; use std::borrow::Cow; use glam::{Vec2, Vec4, vec2}; @@ -49,13 +49,13 @@ pub struct UiVertex { pub position: Vec2, pub color: Vec4, pub uv: Vec2, - pub bind_texture: Option, } #[derive(Default)] pub struct UiDrawCall { pub vertices: Vec, pub indices: Vec, + pub bind_texture: Option, } #[derive(Default)] @@ -64,7 +64,7 @@ pub struct UiDrawPlan { } impl UiDrawPlan { - pub fn build(calls: &UiDrawCommands) -> Self { + pub fn build(calls: &UiDrawCommands, tr: &mut TextRenderer) -> Self { let mut call = UiDrawCall::default(); for command in &calls.commands { match command { @@ -76,25 +76,21 @@ impl UiDrawPlan { position: *position, color: *color, uv: vec2(0.0, 0.0), - bind_texture: None, }, UiVertex { position: *position + Vec2::new(size.x, 0.0), color: *color, uv: vec2(1.0, 0.0), - bind_texture: None, }, UiVertex { position: *position + *size, color: *color, uv: vec2(1.0, 1.0), - bind_texture: None, }, UiVertex { position: *position + Vec2::new(0.0, size.y), color: *color, uv: vec2(0.0, 1.0), - bind_texture: None, }, ]); }, diff --git a/kubi-ui/src/lib.rs b/kubi-ui/src/lib.rs index 337c557..ee90ebd 100644 --- a/kubi-ui/src/lib.rs +++ b/kubi-ui/src/lib.rs @@ -72,7 +72,7 @@ impl KubiUi { if self.draw_commands.commands == self.prev_draw_commands.commands { return } - self.draw_plan = UiDrawPlan::build(&self.draw_commands); + self.draw_plan = UiDrawPlan::build(&self.draw_commands, &mut self.text_renderer); self.draw_plan_modified = true; }