52 lines
1.4 KiB
C++
52 lines
1.4 KiB
C++
/********************\
|
|
| Copyright 2024, |
|
|
| Ulysse Cura |
|
|
\********************/
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
// //
|
|
// Vector2D et une classe template qui est similaire a SDL_Point. //
|
|
// //
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
#ifndef VECTOR2D_HPP
|
|
#define VECTOR2D_HPP
|
|
|
|
#include <iosfwd>
|
|
|
|
template<typename T>
|
|
struct Vector2D {
|
|
T x;
|
|
T y;
|
|
|
|
Vector2D();
|
|
Vector2D(T, T);
|
|
template <typename U>
|
|
Vector2D(const Vector2D<U>&);
|
|
|
|
Vector2D<T> &operator+=(const Vector2D<T> &) noexcept;
|
|
Vector2D<T> &operator-=(const Vector2D<T> &) noexcept;
|
|
Vector2D<T> &operator*=(const Vector2D<T> &) noexcept;
|
|
Vector2D<T> &operator/=(const Vector2D<T> &) noexcept;
|
|
|
|
Vector2D<T> operator*(const T &) noexcept;
|
|
Vector2D<T> operator/(const T &) noexcept;
|
|
Vector2D<T> &zero() noexcept;
|
|
};
|
|
|
|
template<typename T>
|
|
Vector2D<T> operator+(const Vector2D<T> &, const Vector2D<T> &);
|
|
|
|
template<typename T>
|
|
Vector2D<T> operator-(const Vector2D<T> &, const Vector2D<T> &);
|
|
|
|
template<typename T>
|
|
Vector2D<T> operator*(const Vector2D<T> &, const Vector2D<T> &);
|
|
|
|
template<typename T>
|
|
Vector2D<T> operator/(const Vector2D<T> &, const Vector2D<T> &);
|
|
|
|
#include "Vector2D.tpp"
|
|
|
|
#endif
|