1 #ifndef GONG_GRAPHICS_ALIGN_HPP_
2 #define GONG_GRAPHICS_ALIGN_HPP_
28 inline Align get_x(Gravity g) noexcept {
29 return Align(int(g) % 3);
32 inline Align get_y(Gravity g) noexcept {
33 return Align(int(g) / 3);
36 inline Gravity get_gravity(Align x, Align y) noexcept {
37 return Gravity(int(y) * 3 + int(x));
40 inline glm::vec2 align(
42 const glm::vec2 &size,
43 const glm::vec2 &offset = glm::vec2(0.0f, 0.0f)
46 size.x * 0.5 * int(get_x(g)) + offset.x,
47 size.y * 0.5 * int(get_y(g)) + offset.y