Game Development Reference
In-Depth Information
1.5.1.5Center
result.Left() = to.Center().x() - ( from.Width() / 2 );
The center alignment refers to the horizontal alignment, to align the centers by taking the
center of the fixed rectangle and subtracting half the width of our floating rectangle.
1.5.1.6Middle
result.Top() = to.Center().y() - (from.Height() / 2);
The middle refers to the vertical center of the rectangles, to align the centers vertically, we
use the fixed rectangle's center and subtract half of our floating rectangle's height.
The full alignment function works in a way that it supports the combination of multiple
flags,withtheexceptionofcombining Top|Bottom and Left|Right whichdon'tmakesense.
Search WWH ::




Custom Search