cpp_drawing/primitives/rectangle.cpp
2025-09-26 11:00:11 +02:00

26 lines
633 B
C++

#include "rectangle.hpp"
#include "math/transforms.hpp"
#include "contexts/drawing_context.hpp"
void primitives::Rectangle::Translate(const math::Vector& offset)
{
m_pos += offset;
}
void primitives::Rectangle::Rotate(const math::Vector& center, float angle)
{
m_pos = math::RotatePoint(center, angle, m_pos);
m_angle = math::RotateAngle(m_angle, angle);
}
void primitives::Rectangle::Scale(const math::Vector& center, float factor)
{
m_pos = math::ScalePoint(center, factor, m_pos);
m_size *= factor;
}
void primitives::Rectangle::Draw(DrawingContext& ctx)
{
ctx.DrawRectangle(m_pos, m_size, m_angle);
}