mirror of
https://github.com/orange-cpp/omath.git
synced 2026-04-19 07:23:27 +00:00
added spacer
This commit is contained in:
@@ -99,11 +99,17 @@ namespace omath::hud::widget
|
|||||||
template<typename W>
|
template<typename W>
|
||||||
Centered(W) -> Centered<W>;
|
Centered(W) -> Centered<W>;
|
||||||
|
|
||||||
|
/// Empty gap that advances the side cursor without drawing.
|
||||||
|
struct Spacer
|
||||||
|
{
|
||||||
|
float size;
|
||||||
|
};
|
||||||
|
|
||||||
// ── Side widget variant ───────────────────────────────────────────────────
|
// ── Side widget variant ───────────────────────────────────────────────────
|
||||||
struct None
|
struct None
|
||||||
{
|
{
|
||||||
}; ///< No-op placeholder — used by widget::when for disabled elements.
|
}; ///< No-op placeholder — used by widget::when for disabled elements.
|
||||||
using SideWidget = std::variant<None, Bar, DashedBar, Label, Centered<Label>>;
|
using SideWidget = std::variant<None, Bar, DashedBar, Label, Centered<Label>, Spacer>;
|
||||||
|
|
||||||
// ── Side containers ───────────────────────────────────────────────────────
|
// ── Side containers ───────────────────────────────────────────────────────
|
||||||
// Storing std::initializer_list<SideWidget> is safe here: the backing array
|
// Storing std::initializer_list<SideWidget> is safe here: the backing array
|
||||||
|
|||||||
@@ -509,6 +509,10 @@ namespace omath::hud
|
|||||||
{
|
{
|
||||||
add_right_label(w.child.color, w.child.offset, w.child.outlined, w.child.text);
|
add_right_label(w.child.color, w.child.offset, w.child.outlined, w.child.text);
|
||||||
},
|
},
|
||||||
|
[this](const widget::Spacer& w)
|
||||||
|
{
|
||||||
|
m_text_cursor_right.x += w.size;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
child);
|
child);
|
||||||
}
|
}
|
||||||
@@ -538,6 +542,10 @@ namespace omath::hud
|
|||||||
{
|
{
|
||||||
add_left_label(w.child.color, w.child.offset, w.child.outlined, w.child.text);
|
add_left_label(w.child.color, w.child.offset, w.child.outlined, w.child.text);
|
||||||
},
|
},
|
||||||
|
[this](const widget::Spacer& w)
|
||||||
|
{
|
||||||
|
m_text_cursor_left.x -= w.size;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
child);
|
child);
|
||||||
}
|
}
|
||||||
@@ -567,6 +575,10 @@ namespace omath::hud
|
|||||||
{
|
{
|
||||||
add_centered_top_label(w.child.color, w.child.offset, w.child.outlined, w.child.text);
|
add_centered_top_label(w.child.color, w.child.offset, w.child.outlined, w.child.text);
|
||||||
},
|
},
|
||||||
|
[this](const widget::Spacer& w)
|
||||||
|
{
|
||||||
|
m_text_cursor_top.y -= w.size;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
child);
|
child);
|
||||||
}
|
}
|
||||||
@@ -596,6 +608,10 @@ namespace omath::hud
|
|||||||
add_centered_bottom_label(w.child.color, w.child.offset, w.child.outlined,
|
add_centered_bottom_label(w.child.color, w.child.offset, w.child.outlined,
|
||||||
w.child.text);
|
w.child.text);
|
||||||
},
|
},
|
||||||
|
[this](const widget::Spacer& w)
|
||||||
|
{
|
||||||
|
m_text_cursor_bottom.y += w.size;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
child);
|
child);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user