A small game engine for 2D games based of Raylib
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
766 B

#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)};
}
}