1 #ifndef BLANK_GRAPHICS_ALIGN_HPP_
2 #define BLANK_GRAPHICS_ALIGN_HPP_
27 inline Align get_x(Gravity g) noexcept {
28 return Align(int(g) % 3);
31 inline Align get_y(Gravity g) noexcept {
32 return Align(int(g) / 3);
35 inline Gravity get_gravity(Align x, Align y) noexcept {
36 return Gravity(int(y) * 3 + int(x));
39 inline glm::vec2 align(
41 const glm::vec2 &size,
42 const glm::vec2 &offset = glm::vec2(0.0f, 0.0f)
45 size.x * 0.5 * int(get_x(g)) + offset.x,
46 size.y * 0.5 * int(get_y(g)) + offset.y