added files

This commit is contained in:
2026-03-13 20:51:59 +03:00
parent 29f3e2565d
commit 9da19582b5
7 changed files with 187 additions and 0 deletions

27
source/hud/canvas_box.cpp Normal file
View File

@@ -0,0 +1,27 @@
//
// Created by orange on 13.03.2026.
//
//
// Created by Vlad on 6/17/2025.
//
#include "omath/hud/canvas_box.hpp"
namespace omath::hud
{
CanvasBox::CanvasBox(const Vector2<float> top, Vector2<float> bottom, const float ratio)
{
bottom.x = top.x;
const auto height = std::abs(top.y - bottom.y);
top_left_corner = top - Vector2<float>{height / ratio, 0};
top_right_corner = top + Vector2<float>{height / ratio, 0};
bottom_left_corner = bottom - Vector2<float>{height / ratio, 0};
bottom_right_corner = bottom + Vector2<float>{height / ratio, 0};
}
std::array<Vector2<float>, 4> CanvasBox::as_array() const
{
return {top_left_corner, top_right_corner, bottom_right_corner, bottom_left_corner};
}
} // namespace ohud