improved bars

This commit is contained in:
2026-07-12 11:17:50 +03:00
parent 2c6d7c2dfa
commit feb26e01c6
4 changed files with 74 additions and 28 deletions
+6 -15
View File
@@ -251,7 +251,6 @@ namespace imgui_desktop::gui
const auto box_gradient_bottom = animated_color(m_box_gradient_bottom, 0.5f);
const auto red = omath::Color{1.f, 0.f, 0.f, 1.f};
const auto green = omath::Color{0.f, 1.f, 0.f, 1.f};
const auto bar_value_color = omath::Color{red.value() * (1.f - m_bar_value) + green.value() * m_bar_value};
const auto make_glow = [](const GlowSettings& settings) -> std::optional<Glow>
{
if (!settings.enabled)
@@ -263,16 +262,8 @@ namespace imgui_desktop::gui
const auto bar_glow = make_glow(m_bar_glow);
const auto label_glow = make_glow(m_label_glow);
const auto canvas_glow = make_glow(m_canvas_glow);
const Paint vertical_bar_color =
m_gradient_bars ? Paint{omath::hud::Gradient{bar_value_color, bar_value_color, red, red}}
: Paint{m_bar_color};
const Paint horizontal_bar_color =
m_gradient_bars ? Paint{omath::hud::Gradient{red, bar_value_color, bar_value_color, red}}
: Paint{m_bar_color};
const Bar vertical_bar{vertical_bar_color, m_bar_outline_color, m_bar_bg_color, m_bar_width,
m_bar_value, m_bar_offset, bar_glow};
const Bar horizontal_bar{horizontal_bar_color, m_bar_outline_color, m_bar_bg_color, m_bar_width,
m_bar_value, m_bar_offset, bar_glow};
const BarPaint bar_color = m_gradient_bars ? BarPaint{BarGradient{red, green}} : BarPaint{m_bar_color};
const Bar bar{bar_color, m_bar_outline_color, m_bar_bg_color, m_bar_width, m_bar_value, m_bar_offset, bar_glow};
const Paint box_fill = m_gradient_box_fill
? Paint{omath::hud::Gradient{box_gradient_top, box_gradient_top,
box_gradient_bottom, box_gradient_bottom}}
@@ -299,7 +290,7 @@ namespace imgui_desktop::gui
m_corner_ratio, m_box_thickness, cornered_box_glow}),
when(m_show_dashed_box, DashedBox{m_dash_color, m_dash_len, m_dash_gap, m_dash_thickness}),
RightSide{
when(m_show_right_bar, vertical_bar),
when(m_show_right_bar, bar),
when(m_show_right_dashed_bar, dbar),
when(m_show_right_labels, Label{{0.f, 1.f, 0.f, 1.f},
m_label_offset,
@@ -319,7 +310,7 @@ namespace imgui_desktop::gui
m_ring_thickness, m_ring_offset}),
},
LeftSide{
when(m_show_left_bar, vertical_bar),
when(m_show_left_bar, bar),
when(m_show_left_dashed_bar, dbar),
when(m_show_left_labels,
Label{omath::Color::from_rgba(255, 128, 0, 255), m_label_offset,
@@ -329,7 +320,7 @@ namespace imgui_desktop::gui
outline_helper(m_outlined), "Level: 42"}),
},
TopSide{
when(m_show_top_bar, horizontal_bar),
when(m_show_top_bar, bar),
when(m_show_top_dashed_bar, dbar),
when(m_show_centered_top,
Centered{Label{omath::Color::from_rgba(0, 255, 255, 255), m_label_offset,
@@ -340,7 +331,7 @@ namespace imgui_desktop::gui
outline_helper(m_outlined), "*BLEEDING*"}),
},
BottomSide{
when(m_show_bottom_bar, horizontal_bar),
when(m_show_bottom_bar, bar),
when(m_show_bottom_dashed_bar, dbar),
when(m_show_centered_bottom,
Centered{Label{centered_label_color, m_label_offset, outline_helper(m_outlined),