*important* sf::Rect now uses Width/Height instead of Right/Bottom

Removed Offset, GetSize and GetCenter functions from sf::Rect
Added a sf::Rect constructor taking two Vector2 parameters
Updated the API documentation of the sf::Rect class

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1503 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
LaurentGom 2010-04-09 13:04:49 +00:00
parent ae2ae15e12
commit 082a928555
11 changed files with 205 additions and 196 deletions
src/SFML/Graphics

View file

@ -153,8 +153,8 @@ IntRect RenderTarget::GetViewport(const View& view) const
return IntRect(static_cast<int>(0.5f + width * viewport.Left),
static_cast<int>(0.5f + height * viewport.Top),
static_cast<int>(0.5f + width * viewport.Right),
static_cast<int>(0.5f + height * viewport.Bottom));
static_cast<int>(width * viewport.Width),
static_cast<int>(height * viewport.Height));
}
@ -171,8 +171,8 @@ Vector2f RenderTarget::ConvertCoords(unsigned int x, unsigned int y, const View&
// First, convert from viewport coordinates to homogeneous coordinates
Vector2f coords;
IntRect viewport = GetViewport(view);
coords.x = -1.f + 2.f * (static_cast<int>(x) - viewport.Left) / viewport.GetSize().x;
coords.y = 1.f - 2.f * (static_cast<int>(y) - viewport.Top) / viewport.GetSize().y;
coords.x = -1.f + 2.f * (static_cast<int>(x) - viewport.Left) / viewport.Width;
coords.y = 1.f - 2.f * (static_cast<int>(y) - viewport.Top) / viewport.Height;
// Then transform by the inverse of the view matrix
return view.GetInverseMatrix().Transform(coords);