chore: moved vector class to core/math
parent
ceda802936
commit
72ce2044f4
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#define VECTOR_EPSILON 0.00001f
|
#define VECTOR_EPSILON 0.00001f
|
||||||
|
|
||||||
|
namespace ce {
|
||||||
Vecf::Vecf(float x, float y)
|
Vecf::Vecf(float x, float y)
|
||||||
: x{x}, y{y} {}
|
: x{x}, y{y} {}
|
||||||
|
|
||||||
|
@ -99,3 +100,4 @@ void Vecf::scale(float x, float y) {
|
||||||
void Vecf::scale(Vecf const &factors) {
|
void Vecf::scale(Vecf const &factors) {
|
||||||
this->scale(factors.x, factors.y);
|
this->scale(factors.x, factors.y);
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -4,7 +4,10 @@
|
||||||
#include <SDL2/SDL_rect.h>
|
#include <SDL2/SDL_rect.h>
|
||||||
#include <initializer_list>
|
#include <initializer_list>
|
||||||
|
|
||||||
|
namespace ce {
|
||||||
struct Vecf {
|
struct Vecf {
|
||||||
|
float x{0.f}, y{0.f};
|
||||||
|
|
||||||
Vecf() = default;
|
Vecf() = default;
|
||||||
Vecf(float x, float y);
|
Vecf(float x, float y);
|
||||||
Vecf(std::initializer_list<float> members);
|
Vecf(std::initializer_list<float> members);
|
||||||
|
@ -49,8 +52,6 @@ struct Vecf {
|
||||||
void scale(float x, float y);
|
void scale(float x, float y);
|
||||||
//! scale vector member-wise
|
//! scale vector member-wise
|
||||||
void scale(Vecf const &factors);
|
void scale(Vecf const &factors);
|
||||||
|
|
||||||
float x{0.f}, y{0.f};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline
|
static inline
|
||||||
|
@ -97,5 +98,6 @@ static inline
|
||||||
Vecf &operator/=(Vecf &lhs, float rhs) {
|
Vecf &operator/=(Vecf &lhs, float rhs) {
|
||||||
return lhs = lhs * rhs;
|
return lhs = lhs * rhs;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // !VECTOR_MATH_HPP
|
#endif // !VECTOR_MATH_HPP
|
Loading…
Reference in New Issue