added realization

This commit is contained in:
2026-03-13 21:09:12 +03:00
parent 9da19582b5
commit 87966c82b9
5 changed files with 185 additions and 16 deletions

View File

@@ -10,13 +10,7 @@
#include <string_view>
namespace omath::hud
{
enum class SnapLineStartPosition
{
SCREEN_BOTTOM,
SCREEN_TOP,
SCREEN_CENTER,
};
class EntityOverlay
class EntityOverlay final
{
public:
EntityOverlay(const Vector2<float>& top, const Vector2<float>& bottom,
@@ -59,14 +53,14 @@ namespace omath::hud
void add_top_bar(const Color& color, const Color& outline_color, const Color& bg_color, float height,
float ratio, float offset = 5.f);
void add_snap_line(const SnapLineStartPosition& start_pos, const Color& color, float width);
void add_snap_line(const Vector3<float>& start_pos, const Color& color, float width);
private:
static void draw_outlined_text(const Vector2<float>& position, const Color& color,
void draw_outlined_text(const Vector2<float>& position, const Color& color,
const std::string_view& text);
CanvasBox m_canvas;
Vector2<float> m_text_cursor_right;
Vector2<float> m_text_cursor_top;
std::shared_ptr<HudRendererInterface> renderer;
std::shared_ptr<HudRendererInterface> m_renderer;
};
} // namespace omath::hud

View File

@@ -14,9 +14,9 @@ namespace omath::hud
virtual void add_line(const Vector2<float>& line_start, const Vector2<float>& line_end, const Color& color,
float thickness) = 0;
virtual void add_polyline(const std::span<const Vector2<float>>& vertexes, float thickness) = 0;
virtual void add_polyline(const std::span<const Vector2<float>>& vertexes, const Color& color, float thickness) = 0;
virtual void add_filled_polyline(const std::span<const Vector2<float>>& vertexes, float thickness) = 0;
virtual void add_filled_polyline(const std::span<const Vector2<float>>& vertexes, const Color& color, float thickness) = 0;
virtual void add_rectangle(const Vector2<float>& min, const Vector2<float>& max, const Color& color) = 0;

View File

@@ -11,8 +11,8 @@ namespace omath::hud
~ImguiHudRenderer() override;
void add_line(const Vector2<float>& line_start, const Vector2<float>& line_end, const Color& color,
float thickness) override;
void add_polyline(const std::span<const Vector2<float>>& vertexes, float thickness) override;
void add_filled_polyline(const std::span<const Vector2<float>>& vertexes, float thickness) override;
void add_polyline(const std::span<const Vector2<float>>& vertexes, const Color& color, float thickness) override;
void add_filled_polyline(const std::span<const Vector2<float>>& vertexes, const Color& color, float thickness) override;
void add_rectangle(const Vector2<float>& min, const Vector2<float>& max, const Color& color) override;
void add_filled_rectangle(const Vector2<float>& min, const Vector2<float>& max, const Color& color) override;
void add_text(const Vector2<float>& position, const Color& color, const std::string_view& text) override;