Renamed Corner enum to BoxCorner
Added RectCorner and Rect::GetCorner method Former-commit-id: dc99823ceb17f6e91cdf12779c982ab7e024ec24
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user