Renamed Corner enum to BoxCorner

Added RectCorner and Rect::GetCorner method


Former-commit-id: dc99823ceb17f6e91cdf12779c982ab7e024ec24
This commit is contained in:
Lynix
2015-01-03 22:31:25 +01:00
parent 4e9bec804a
commit 7c47a93a72
11 changed files with 149 additions and 115 deletions

View File

@@ -109,6 +109,28 @@ NzVector2<T> NzRect<T>::GetCenter() const
return GetPosition() + GetLengths() / F(2.0);
}
template<typename T>
NzVector2<T> NzRect<T>::GetCorner(nzRectCorner corner) const
{
switch (corner)
{
case nzRectCorner_LeftBottom:
return NzVector2<T>(x, y + height);
case nzRectCorner_LeftTop:
return NzVector2<T>(x, y);
case nzRectCorner_RightBottom:
return NzVector2<T>(x + width, y + height);
case nzRectCorner_RightTop:
return NzVector2<T>(x + width, y);
}
NazaraError("Corner not handled (0x" + NzString::Number(corner, 16) + ')');
return NzVector2<T>();
}
template<typename T>
NzVector2<T> NzRect<T>::GetLengths() const
{