fix: more C++-style SDL_FPoint construction + implemented &src constructor

main
Sara 2024-11-22 18:16:41 +01:00
parent a504bae0f6
commit 23a913c9f1
1 changed files with 4 additions and 1 deletions

View File

@ -8,6 +8,9 @@ namespace ce {
Vecf::Vecf(float x, float y) Vecf::Vecf(float x, float y)
: x{x}, y{y} {} : x{x}, y{y} {}
Vecf::Vecf(Vecf const &src)
: x{src.x}, y{src.y} {}
Vecf::Vecf(Vecf const &&src) Vecf::Vecf(Vecf const &&src)
: x{src.x}, y{src.y} {} : x{src.x}, y{src.y} {}
@ -28,7 +31,7 @@ Vecf &Vecf::operator=(std::initializer_list<float> list) {
} }
Vecf::operator SDL_FPoint() { Vecf::operator SDL_FPoint() {
return (SDL_FPoint){this->x, this->y}; return SDL_FPoint{this->x, this->y};
} }
float Vecf::sqr_distance(Vecf const &from, Vecf const &to) { float Vecf::sqr_distance(Vecf const &from, Vecf const &to) {