mirror of
https://github.com/SFML/SFML.git
synced 2024-11-28 22:31:09 +08:00
Use sf::Rect<T>::getCenter()
in more places
This commit is contained in:
parent
24a935b623
commit
27acbab3d9
@ -47,9 +47,7 @@ struct SFMLmainWindow
|
|||||||
|
|
||||||
logo.setSmooth(true);
|
logo.setSmooth(true);
|
||||||
|
|
||||||
sf::FloatRect rect = sprite.getLocalBounds();
|
sprite.setOrigin(sprite.getLocalBounds().getCenter());
|
||||||
sf::Vector2f size(rect.width, rect.height);
|
|
||||||
sprite.setOrigin(size / 2.f);
|
|
||||||
sprite.scale({0.3f, 0.3f});
|
sprite.scale({0.3f, 0.3f});
|
||||||
|
|
||||||
unsigned int ww = renderWindow.getSize().x;
|
unsigned int ww = renderWindow.getSize().x;
|
||||||
|
@ -398,8 +398,7 @@ void Text::ensureGeometryUpdate() const
|
|||||||
// Compute the location of the strike through dynamically
|
// Compute the location of the strike through dynamically
|
||||||
// We use the center point of the lowercase 'x' glyph as the reference
|
// We use the center point of the lowercase 'x' glyph as the reference
|
||||||
// We reuse the underline thickness as the thickness of the strike through as well
|
// We reuse the underline thickness as the thickness of the strike through as well
|
||||||
const FloatRect xBounds = m_font->getGlyph(U'x', m_characterSize, isBold).bounds;
|
const float strikeThroughOffset = m_font->getGlyph(U'x', m_characterSize, isBold).bounds.getCenter().y;
|
||||||
const float strikeThroughOffset = xBounds.top + xBounds.height / 2.f;
|
|
||||||
|
|
||||||
// Precompute the variables needed by the algorithm
|
// Precompute the variables needed by the algorithm
|
||||||
float whitespaceWidth = m_font->getGlyph(U' ', m_characterSize, isBold).advance;
|
float whitespaceWidth = m_font->getGlyph(U' ', m_characterSize, isBold).advance;
|
||||||
|
Loading…
Reference in New Issue
Block a user