Made Cube/Rect more user-friendly
Former-commit-id: 13ac0b9f6428059596c98f636caf61afd2a436b7
This commit is contained in:
@@ -10,6 +10,12 @@
|
||||
|
||||
#define F(a) static_cast<T>(a)
|
||||
|
||||
template<typename T>
|
||||
NzRect<T>::NzRect(T Width, T Height)
|
||||
{
|
||||
Set(Width, Height);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzRect<T>::NzRect(T X, T Y, T Width, T Height)
|
||||
{
|
||||
@@ -22,6 +28,12 @@ NzRect<T>::NzRect(const T vec[4])
|
||||
Set(vec);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzRect<T>::NzRect(const NzVector2<T>& size)
|
||||
{
|
||||
Set(size);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzRect<T>::NzRect(const NzVector2<T>& vec1, const NzVector2<T>& vec2)
|
||||
{
|
||||
@@ -178,6 +190,17 @@ NzRect<T>& NzRect<T>::MakeZero()
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzRect<T>& NzRect<T>::Set(T Width, T Height)
|
||||
{
|
||||
x = F(0.0);
|
||||
y = F(0.0);
|
||||
width = Width;
|
||||
height = Height;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzRect<T>& NzRect<T>::Set(T X, T Y, T Width, T Height)
|
||||
{
|
||||
@@ -208,6 +231,12 @@ NzRect<T>& NzRect<T>::Set(const NzRect<T>& rect)
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzRect<T>& NzRect<T>::Set(const NzVector2<T>& size)
|
||||
{
|
||||
return Set(size.x, size.y);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzRect<T>& NzRect<T>::Set(const NzVector2<T>& vec1, const NzVector2<T>& vec2)
|
||||
{
|
||||
@@ -279,6 +308,12 @@ NzRect<T> NzRect<T>::operator*(T scalar) const
|
||||
return NzRect(x, y, width*scalar, height*scalar);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzRect<T> NzRect<T>::operator*(const NzVector2<T>& vec) const
|
||||
{
|
||||
return NzRect(x, y, width*vec.x, height*vec.y);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzRect<T>& NzRect<T>::operator*=(T scalar)
|
||||
{
|
||||
@@ -286,6 +321,13 @@ NzRect<T>& NzRect<T>::operator*=(T scalar)
|
||||
height *= scalar;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzRect<T>& NzRect<T>::operator*=(const NzVector2<T>& vec)
|
||||
{
|
||||
width *= vec.x;
|
||||
height *= vec.y;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool NzRect<T>::operator==(const NzRect& rect) const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user