Add Font BoundingBox calculation
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
#include "copium/util/BoundingBox.h"
|
||||
|
||||
namespace Copium
|
||||
{
|
||||
BoundingBox::BoundingBox()
|
||||
: l{0.0f}, b{0.0f}, r{0.0f}, t{0.0f}
|
||||
{}
|
||||
|
||||
BoundingBox::BoundingBox(float all)
|
||||
: l{all}, b{all}, r{all}, t{all}
|
||||
{}
|
||||
|
||||
BoundingBox::BoundingBox(float l, float b, float r, float t)
|
||||
: l{l}, b{b}, r{r}, t{t}
|
||||
{}
|
||||
|
||||
BoundingBox::BoundingBox(glm::vec2 lb, glm::vec2 rt)
|
||||
: lb{lb}, rt{rt}
|
||||
{}
|
||||
|
||||
glm::vec2 BoundingBox::GetSize() const
|
||||
{
|
||||
return rt - lb;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
namespace Copium
|
||||
{
|
||||
struct BoundingBox
|
||||
{
|
||||
union
|
||||
{
|
||||
struct { float l; float b; float r; float t; };
|
||||
struct { glm::vec2 lb; glm::vec2 rt; };
|
||||
struct { glm::vec4 lbrt; };
|
||||
};
|
||||
BoundingBox();
|
||||
BoundingBox(float all);
|
||||
BoundingBox(float l, float b, float r, float t);
|
||||
BoundingBox(glm::vec2 lb, glm::vec2 rt);
|
||||
|
||||
glm::vec2 GetSize() const;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user