added enity overlay aspect

This commit is contained in:
va_alpatov
2026-06-08 03:43:08 +03:00
parent 87896117d4
commit b9da58e138
4 changed files with 6 additions and 6 deletions
+2 -1
View File
@@ -71,6 +71,7 @@ namespace imgui_desktop::gui
ImGui::SliderFloat("X##ent", &m_entity_x, 100.f, vp->Size.x - 100.f); ImGui::SliderFloat("X##ent", &m_entity_x, 100.f, vp->Size.x - 100.f);
ImGui::SliderFloat("Top Y", &m_entity_top_y, 20.f, m_entity_bottom_y - 20.f); ImGui::SliderFloat("Top Y", &m_entity_top_y, 20.f, m_entity_bottom_y - 20.f);
ImGui::SliderFloat("Bottom Y", &m_entity_bottom_y, m_entity_top_y + 20.f, vp->Size.y - 20.f); ImGui::SliderFloat("Bottom Y", &m_entity_bottom_y, m_entity_top_y + 20.f, vp->Size.y - 20.f);
ImGui::SliderFloat("Aspect", &m_entity_aspect, 1.f, 10.f);
} }
if (ImGui::CollapsingHeader("Box", ImGuiTreeNodeFlags_DefaultOpen)) if (ImGui::CollapsingHeader("Box", ImGuiTreeNodeFlags_DefaultOpen))
@@ -200,7 +201,7 @@ namespace imgui_desktop::gui
{ {
return is_outline ? Outlined::On : Outlined::Off; return is_outline ? Outlined::On : Outlined::Off;
}; };
omath::hud::EntityOverlay({m_entity_x, m_entity_top_y}, {m_entity_x, m_entity_bottom_y}, omath::hud::EntityOverlay({m_entity_x, m_entity_top_y}, {m_entity_x, m_entity_bottom_y}, m_entity_aspect,
std::make_shared<omath::hud::ImguiHudRenderer>()) std::make_shared<omath::hud::ImguiHudRenderer>())
.contents( .contents(
// ── Boxes ──────────────────────────────────────────────────── // ── Boxes ────────────────────────────────────────────────────
+1 -2
View File
@@ -26,8 +26,7 @@ namespace imgui_desktop::gui
bool m_opened = true; bool m_opened = true;
// Entity // Entity
float m_entity_x = 550.f, m_entity_top_y = 150.f, m_entity_bottom_y = 450.f; float m_entity_x = 550.f, m_entity_top_y = 150.f, m_entity_bottom_y = 450.f, m_entity_aspect = 4.f;
// Box // Box
omath::Color m_box_color{1.f, 1.f, 1.f, 1.f}; omath::Color m_box_color{1.f, 1.f, 1.f, 1.f};
omath::Color m_box_fill{0.f, 0.f, 0.f, 0.f}; omath::Color m_box_fill{0.f, 0.f, 0.f, 0.f};
+1 -1
View File
@@ -15,7 +15,7 @@ namespace omath::hud
class EntityOverlay final class EntityOverlay final
{ {
public: public:
EntityOverlay(const Vector2<float>& top, const Vector2<float>& bottom, EntityOverlay(const Vector2<float>& top, const Vector2<float>& bottom, float aspect,
const std::shared_ptr<HudRendererInterface>& renderer); const std::shared_ptr<HudRendererInterface>& renderer);
// ── Boxes ──────────────────────────────────────────────────────── // ── Boxes ────────────────────────────────────────────────────────
+2 -2
View File
@@ -460,9 +460,9 @@ namespace omath::hud
return *this; return *this;
} }
EntityOverlay::EntityOverlay(const Vector2<float>& top, const Vector2<float>& bottom, EntityOverlay::EntityOverlay(const Vector2<float>& top, const Vector2<float>& bottom, const float aspect,
const std::shared_ptr<HudRendererInterface>& renderer) const std::shared_ptr<HudRendererInterface>& renderer)
: m_canvas(top, bottom), m_text_cursor_right(m_canvas.top_right_corner), : m_canvas(top, bottom, aspect), m_text_cursor_right(m_canvas.top_right_corner),
m_text_cursor_top(m_canvas.top_left_corner), m_text_cursor_bottom(m_canvas.bottom_left_corner), m_text_cursor_top(m_canvas.top_left_corner), m_text_cursor_bottom(m_canvas.bottom_left_corner),
m_text_cursor_left(m_canvas.top_left_corner), m_renderer(renderer) m_text_cursor_left(m_canvas.top_left_corner), m_renderer(renderer)
{ {