25 lines
624 B
C++
25 lines
624 B
C++
#pragma once
|
|
|
|
#include <glm/glm.hpp>
|
|
|
|
namespace charcoal
|
|
{
|
|
template <typename T>
|
|
struct Rectangle
|
|
{
|
|
Rectangle(T top, T bottom, T left, T right)
|
|
: top(top), bottom(bottom), left(left), right(right)
|
|
{}
|
|
Rectangle(const glm::tvec2<T>& top_left, const glm::tvec2<T>& bottom_right)
|
|
: top(top_left.y), bottom(bottom_right.y), left(top_left.x), right(bottom_right.x)
|
|
{}
|
|
Rectangle(const glm::tvec2<T>& center, T width, T height)
|
|
: top(center.y + height / 2.0f), bottom(center.y - height / 2.0f), left(center.x - width / 2.0f), right(center.x + width / 2.0f)
|
|
{}
|
|
|
|
T top;
|
|
T bottom;
|
|
T left;
|
|
T right;
|
|
};
|
|
} |