From 277fd4c27dd7f701f5df3cdc67679c40e352b1e0 Mon Sep 17 00:00:00 2001 From: griffi-gh Date: Wed, 22 Nov 2023 14:33:35 +0100 Subject: [PATCH] pub progressbar, impl default --- kubi-ui/src/element/progress_bar.rs | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/kubi-ui/src/element/progress_bar.rs b/kubi-ui/src/element/progress_bar.rs index e9ec7de..3ee9a99 100644 --- a/kubi-ui/src/element/progress_bar.rs +++ b/kubi-ui/src/element/progress_bar.rs @@ -1,4 +1,4 @@ -use glam::{vec2, Vec4}; +use glam::{vec2, Vec4, vec4}; use crate::{ UiSize, LayoutInfo, draw::UiDrawCommand, @@ -7,11 +7,22 @@ use crate::{ }; use super::UiElement; -struct ProgressBar { - size: (UiSize, UiSize), - value: f32, - color_foreground: Vec4, - color_background: Vec4, +pub struct ProgressBar { + pub size: (UiSize, UiSize), + pub value: f32, + pub color_foreground: Vec4, + pub color_background: Vec4, +} + +impl Default for ProgressBar { + fn default() -> Self { + Self { + size: (UiSize::Auto, UiSize::Auto), + value: 0., + color_foreground: vec4(0.0, 0.0, 1.0, 1.0), + color_background: vec4(0.0, 0.0, 0.0, 1.0), + } + } } const BAR_HEIGHT: f32 = 20.0;