bevy_ui_builders/progress/
types.rs

1//! Progress bar component types and markers
2
3use bevy::prelude::*;
4
5/// Component for progress bars
6#[derive(Component, Debug)]
7pub struct ProgressBar {
8    pub value: f32, // 0.0 to 1.0
9    pub style: ProgressBarStyle,
10    pub animated: bool,
11}
12
13/// Progress bar style variants
14#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
15pub enum ProgressBarStyle {
16    #[default]
17    Default,   // Standard progress bar
18    Thin,      // Thinner bar
19    Thick,     // Thicker bar
20    Segmented, // Segmented appearance
21}
22
23impl ProgressBarStyle {
24    pub fn height(&self) -> f32 {
25        match self {
26            ProgressBarStyle::Thin => 4.0,
27            ProgressBarStyle::Thick => 12.0,
28            _ => 8.0,
29        }
30    }
31
32    pub fn track_color(&self) -> Color {
33        crate::colors::BACKGROUND_DARK
34    }
35
36    pub fn fill_color(&self) -> Color {
37        crate::colors::PRIMARY
38    }
39}
40
41/// Marker component for the fill portion of a progress bar
42#[derive(Component)]
43pub struct ProgressBarFill;
44
45/// Marker component for the track/background of a progress bar
46#[derive(Component)]
47pub struct ProgressBarTrack;
48
49/// Marker component for the progress bar label
50#[derive(Component)]
51pub struct ProgressBarLabel;