Added GetLocalBounds and GetGlobalBounds functions to drawable classes

This commit is contained in:
Laurent Gomila committed 2012-02-10 17:13:31 +01:00
1 parent 441703a997
commit cc8d8ed07b
10 files changed
+320

No files matched your search

+32
View File
@@ -269,3 +269,35 @@ void sfText_FindCharacterPos(const sfText* text, size_t index, float* x, float*
if (y)
*y = pos.y;
}
////////////////////////////////////////////////////////////
sfFloatRect sfText_GetLocalBounds(const sfText* text)
{
sfFloatRect rect = {0, 0, 0, 0};
CSFML_CHECK_RETURN(text, rect);
sf::FloatRect sfmlRect = text->This.GetLocalBounds();
rect.Left = sfmlRect.Left;
rect.Top = sfmlRect.Top;
rect.Width = sfmlRect.Width;
rect.Height = sfmlRect.Height;
return rect;
}
////////////////////////////////////////////////////////////
sfFloatRect sfText_GetGlobalBounds(const sfText* text)
{
sfFloatRect rect = {0, 0, 0, 0};
CSFML_CHECK_RETURN(text, rect);
sf::FloatRect sfmlRect = text->This.GetGlobalBounds();
rect.Left = sfmlRect.Left;
rect.Top = sfmlRect.Top;
rect.Width = sfmlRect.Width;
rect.Height = sfmlRect.Height;
return rect;
}