|
|
- #pragma once
- #include <cmath>
- #include <numbers>
-
- namespace ant::core {
- template<typename T = float>
- struct Vec2 {
- T X;
- T Y;
- };
-
- template<typename T>
- auto operator+(const Vec2<T>& lhs, const Vec2<T>& rhs) -> Vec2<T>{
- return {.X = lhs.X + rhs.X, .Y = lhs.Y + rhs.Y};
- }
- template<typename T>
- auto operator*(const Vec2<T>& lhs, const Vec2<T>& rhs) -> Vec2<T>{
- return {.X = lhs.X * rhs.X, .Y = lhs.Y * rhs.Y};
- }
-
- template<typename T = float>
- struct transform {
- Vec2<T> position;
- float angle;
- };
-
- template<typename T>
- auto operator+(const transform<T>& lhs, const transform<T>& rhs) -> transform<T>{
- return {.position = lhs.position + rhs.position, .angle = std::fmod<float>(lhs.angle + rhs.angle, 180.0f)};
- }
- }
|