Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: How would I get the width of text in 3.0.  (Read 176 times)

0 Members and 1 Guest are viewing this topic.

Smavery

  • Newbie
  • *
  • Posts: 1
    • View Profile
How would I get the width of text in 3.0.
« on: January 01, 2025, 08:43:11 am »
in 2.6 I could use "text.getLocalBounds().width" how would I do this in 3.0

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11071
    • View Profile
    • development blog
    • Email
Re: How would I get the width of text in 3.0.
« Reply #1 on: January 01, 2025, 01:01:59 pm »
sf::Rect has size and position as properties now, so in order to access width you'd call size.x.

Check out the migration guide for more details: https://www.sfml-dev.org/tutorials/3.0/getting-started/migrate/#sfrectt
Official FAQ: https://www.sfml-dev.org/faq/
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything