29 lines
674 B
C++
29 lines
674 B
C++
#pragma once
|
|
|
|
#include <glm/glm.hpp>
|
|
|
|
namespace charcoal
|
|
{
|
|
namespace physics
|
|
{
|
|
using namespace glm;
|
|
|
|
struct Rect
|
|
{
|
|
Rect(float top, float bottom, float left, float right)
|
|
: top(top), bottom(bottom), left(left), right(right)
|
|
{}
|
|
Rect(const glm::vec2& top_left, const glm::vec2& bottom_right)
|
|
: top(top_left.y), bottom(bottom_right.y), left(top_left.x), right(bottom_right.x)
|
|
{}
|
|
Rect(const glm::vec2& center, float width, float 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)
|
|
{}
|
|
|
|
float top;
|
|
float bottom;
|
|
float left;
|
|
float right;
|
|
};
|
|
}
|
|
} |