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

Author Topic: Quick Question - Text.GetRect  (Read 8405 times)

0 Members and 1 Guest are viewing this topic.

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Quick Question - Text.GetRect
« on: February 27, 2012, 02:09:55 am »
Just started updating my code to the newly released .Net bindings and I ran into a small issue. Before in my code I would use Text.GetRect() to center the text. Now I am looking around and I don't see anything to replace it. So my question is, is there anyway to get the Rect of a Text? Maybe possibly using the Text.Origin?
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

texus

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • TGUI
    • Email
Quick Question - Text.GetRect
« Reply #1 on: February 27, 2012, 04:05:02 pm »
You can use Text.GetGlobalBounds() or Text.GetLocalBounds().
These functions return FloatRects which contains the Width and Height.
TGUI: C++ SFML GUI

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Quick Question - Text.GetRect
« Reply #2 on: February 27, 2012, 04:15:01 pm »
And please try to use meaningful titles for your posts ;)
Laurent Gomila - SFML developer

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Quick Question - Text.GetRect
« Reply #3 on: February 27, 2012, 04:36:50 pm »
Quote from: "texus"
You can use Text.GetGlobalBounds() or Text.GetLocalBounds().
These functions return FloatRects which contains the Width and Height.

Ok, So I am using the latest bindings for .Net and these appear to be missing. Is this a bug or am I just not seeing it?

http://imageshack.us/photo/my-images/254/missinggetbounds.jpg

Quote
And please try to use meaningful titles for your posts Wink

Sorry, I will change it.
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Quick Question - Text.GetRect
« Reply #4 on: February 27, 2012, 04:41:06 pm »
You're not seeing it because it's private. I'll fix this as soon as possible :)
Laurent Gomila - SFML developer

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Quick Question - Text.GetRect
« Reply #5 on: February 27, 2012, 04:42:17 pm »
Quote from: "Laurent"
You're not seeing it because it's private. I'll fix this as soon as possible :)


Thank you Laurent  :D
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Quick Question - Text.GetRect
« Reply #6 on: February 27, 2012, 07:39:09 pm »
It's fixed.
Laurent Gomila - SFML developer

supdawg

  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: Quick Question - Text.GetRect
« Reply #7 on: December 02, 2012, 02:50:06 am »
what is the difference between getGlobalBound and getLocalBound?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
AW: Re: Quick Question - Text.GetRect
« Reply #8 on: December 02, 2012, 07:24:31 am »
what is the difference between getGlobalBound and getLocalBound?
GlobalBounds will return the axis aligned bounding box, that is it has all the scaling and rotating taken into account, where as LocalBounds simply retirn the original width and height.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/