45 lines
856 B
C++
45 lines
856 B
C++
#pragma once
|
|
|
|
#include "math/vector.hpp"
|
|
#include "shape.hpp"
|
|
|
|
namespace shapes
|
|
{
|
|
|
|
class Rectangle : public Shape
|
|
{
|
|
public:
|
|
Rectangle(const math::Vector& pos, const math::Vector& size) : m_pos(pos), m_size(size), m_angle(0.0f)
|
|
{
|
|
}
|
|
|
|
const math::Vector& GetPosition() const
|
|
{
|
|
return m_pos;
|
|
}
|
|
|
|
const math::Vector& GetSize() const
|
|
{
|
|
return m_size;
|
|
}
|
|
|
|
const float GetAngle() const
|
|
{
|
|
return m_angle;
|
|
}
|
|
|
|
void Translate(const math::Vector& offset) override;
|
|
void Rotate(const math::Vector& center, float angle) override;
|
|
void Scale(const math::Vector& center, float factor) override;
|
|
|
|
void Draw(Renderer& renderer) const override;
|
|
|
|
~Rectangle() override = default;
|
|
|
|
private:
|
|
math::Vector m_pos;
|
|
math::Vector m_size;
|
|
float m_angle;
|
|
};
|
|
|
|
} // namespace shapes
|