chore: moved vector class to core/math

main
Sara 2024-11-21 08:32:57 +01:00
parent ceda802936
commit 72ce2044f4
2 changed files with 6 additions and 2 deletions

View File

@ -4,6 +4,7 @@
#define VECTOR_EPSILON 0.00001f
namespace ce {
Vecf::Vecf(float x, float y)
: x{x}, y{y} {}
@ -99,3 +100,4 @@ void Vecf::scale(float x, float y) {
void Vecf::scale(Vecf const &factors) {
this->scale(factors.x, factors.y);
}
}

View File

@ -4,7 +4,10 @@
#include <SDL2/SDL_rect.h>
#include <initializer_list>
namespace ce {
struct Vecf {
float x{0.f}, y{0.f};
Vecf() = default;
Vecf(float x, float y);
Vecf(std::initializer_list<float> members);
@ -49,8 +52,6 @@ struct Vecf {
void scale(float x, float y);
//! scale vector member-wise
void scale(Vecf const &factors);
float x{0.f}, y{0.f};
};
static inline
@ -97,5 +98,6 @@ static inline
Vecf &operator/=(Vecf &lhs, float rhs) {
return lhs = lhs * rhs;
}
}
#endif // !VECTOR_MATH_HPP