Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - lineBreaker

Pages: [1]
1
General discussions / Re: Why SFML's vectors are really dump?
« on: November 02, 2021, 02:24:21 pm »
You can find a lot of discussions about SFML's vector and rect classes already on the forum.

Multiplication of two vectors can have different meanings:
Dot product, cross product
So will you add those ready code?


2
General discussions / Also:
« on: October 31, 2021, 09:20:20 am »
If you want a I can make vector3, and vector4 for donating you. It would not be a throuble for me. I can complate them within one week.

3
General discussions / Why SFML's vectors are really dump?
« on: October 31, 2021, 07:27:50 am »
I mean if it has a reason I don't know what it is. Also if it has no reason there is a really good vector struct:

template<typename T>
struct vector2 {
   T r, i;// r: Real, i: Imaginary
   template<typename T0> vector2(const vector2<T0>& R) : r(R.r), i(R.i) {} vector2() : r(0.f), i(0.f) {}
   template<typename T1, typename T2> vector2(const T1& i1, const T2& i2) : r(i1), i(i2) {}
   template<typename T0> vector2(const T0 R[2]) : r(R[0]), i(R[1]) {}

   template<typename T0> const vector2<T>& operator =(const vector2<T0>& R) { r = R.r; i = R.i; return this; }
   template<typename T0> const vector2<T>& operator%=(const vector2<T0>& R) { r %= R.r; i %= R.i; return this; }
   template<typename T0> const vector2<T>& operator+=(const vector2<T0>& R) { r += R.r; i += R.i; return this; }
   template<typename T0> const vector2<T>& operator-=(const vector2<T0>& R) { r -= R.r; i -= R.i; return this; }
   template<typename T0> const vector2<T>& operator*=(const vector2<T0>& R) { r *= R.r; i *= R.i; return this; }
   template<typename T0> const vector2<T>& operator/=(const vector2<T0>& R) { r /= R.r; i /= R.i; return this; }
   template<typename T0> const vector2<T>& operator&=(const vector2<T0>& R) { r &= R.r; i &= R.i; return this; }
   template<typename T0> const vector2<T>& operator|=(const vector2<T0>& R) { r |= R.r; i |= R.i; return this; }
   template<typename T0> const vector2<T>& operator^=(const vector2<T0>& R) { r ^= R.r; i ^= R.i; return this; }
   template<typename T0> const vector2<T>& operator<<=(const vector2<T0>& R) { r <<= R.r; i <<= R.i; return this; }
   template<typename T0> const vector2<T>& operator>>=(const vector2<T0>& R) { r >>= R.r; i >>= R.i; return this; }

   template<typename T0> const vector2<T>& operator =(const T0& R) { r = R; i = R; return this; }
   template<typename T0> const vector2<T>& operator%=(const T0& R) { r %= R; i %= R; return this; }
   template<typename T0> const vector2<T>& operator+=(const T0& R) { r += R; i += R; return this; }
   template<typename T0> const vector2<T>& operator-=(const T0& R) { r -= R; i -= R; return this; }
   template<typename T0> const vector2<T>& operator*=(const T0& R) { r *= R; i *= R; return this; }
   template<typename T0> const vector2<T>& operator/=(const T0& R) { r /= R; i /= R; return this; }
   template<typename T0> const vector2<T>& operator&=(const T0& R) { r &= R; i &= R; return this; }
   template<typename T0> const vector2<T>& operator|=(const T0& R) { r |= R; i |= R; return this; }
   template<typename T0> const vector2<T>& operator^=(const T0& R) { r ^= R; i ^= R; return this; }
   template<typename T0> const vector2<T>& operator<<=(const T0& R) { r <<= R; i <<= R; return this; }
   template<typename T0> const vector2<T>& operator<<=(const T0& R) { r <<= R; i <<= R; return this; }

   template<typename T0> const vector2<T>& operator+(const vector2<T0>& R) const { return vector2<T>(r + R.r, i + R.i); }
   template<typename T0> const vector2<T>& operator-(const vector2<T0>& R) const { return vector2<T>(r - R.r, i - R.i); }
   template<typename T0> const vector2<T>& operator*(const vector2<T0>& R) const { return vector2<T>(r * R.r, i * R.i); }
   template<typename T0> const vector2<T>& operator/(const vector2<T0>& R) const { return vector2<T>(r / R.r, i / R.i); }
   template<typename T0> const vector2<T>& operator%(const vector2<T0>& R) const { return vector2<T>(r % R.r, i % R.i); }
   template<typename T0> const vector2<T>& operator&(const vector2<T0>& R) const { return vector2<T>(r & R.r, i & R.i); }
   template<typename T0> const vector2<T>& operator|(const vector2<T0>& R) const { return vector2<T>(r | R.r, i | R.i); }
   template<typename T0> const vector2<T>& operator<<(const vector2<T0>& R) const { return vector2<T>(r << R.r, i << R.i); }
   template<typename T0> const vector2<T>& operator>>(const vector2<T0>& R) const { return vector2<T>(r >> R.r, i >> R.i); }
   template<typename T0> const bool& operator&&(const vector2<T0>& R) const { return (r && R.r) || (i && R.i); }
   template<typename T0> const bool& operator||(const vector2<T0>& R) const { return (r || R.r) || (i || R.i); }

   template<typename T0> const vector2<T>& operator+(const T0& sc) const { return vector2<T>(r + sc, i + sc); }
   template<typename T0> const vector2<T>& operator-(const T0& sc) const { return vector2<T>(r - sc, i - sc); }
   template<typename T0> const vector2<T>& operator*(const T0& sc) const { return vector2<T>(r * sc, i * sc); }
   template<typename T0> const vector2<T>& operator/(const T0& sc) const { return vector2<T>(r / sc, i / sc); }
   template<typename T0> const vector2<T>& operator%(const T0& sc) const { return vector2<T>(r % sc, i % sc); }
   template<typename T0> const vector2<T>& operator&(const T0& sc) const { return vector2<T>(r & sc, i & sc); }
   template<typename T0> const vector2<T>& operator|(const T0& sc) const { return vector2<T>(r | sc, i | sc); }
   template<typename T0> const vector2<T>& operator^(const T0& sc) const { return vector2<T>(r ^ sc, i ^ sc); }
   template<typename T0> const vector2<T>& operator<<(const T0& sc) const { return vector2<T>(r << sc, i << sc); }
   template<typename T0> const vector2<T>& operator>>(const T0& sc) const { return vector2<T>(r >> sc, i >> sc); }
   template<typename T0> const bool& operator&&(const T0& sc) const { return (r && sc) || (i && sc); }
   template<typename T0> const bool& operator||(const T0& sc) const { return (r || sc) || (i || sc); }

   template<typename T0> const vector2<T>& operator* () const { return vector2<T>(*r, *i); }
   template<typename T0> const vector2<T>& operator- () const { return vector2<T>(-r, -i); }
   const bool& operator!() const { return !(r || i); } operator bool() const { return (r || i); }

   T& operator[](bool ID)  { return ID ? i : r; }
   const T& operator[](bool ID) const { return ID ? i : r; }

   template<typename T0> operator vector2<T0>() const { return {r, i }; }
};

Pages: [1]
anything