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

Author Topic: How to do sf::Text always the same size, regardless window resizing  (Read 1887 times)

0 Members and 1 Guest are viewing this topic.

trilavia

  • Newbie
  • *
  • Posts: 28
    • View Profile
Hi,
for example in browser when you resize the window the text is always the same size. In SFML, when I create 1200x900 window, the text is exactly as I want, but when I maximize the window, it is way too big. Is there any simple way to make the text always be the same size :)?

Thanks

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6275
  • Thor Developer
    • View Profile
    • Bromeon
Re: How to do sf::Text always the same size, regardless window resizing
« Reply #1 on: December 24, 2012, 12:12:17 pm »
React to the Resized event and adjust your view accordingly.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

FRex

  • Hero Member
  • *****
  • Posts: 1839
  • Not doing gamedev/using SFML lately
    • View Profile
    • Email
Re: How to do sf::Text always the same size, regardless window resizing
« Reply #2 on: December 24, 2012, 12:58:09 pm »
You can also inherit from RenderWindow and implement your own onResize method that'll automatically resize the current view.
I'm not using SFML nor doing any gamedev lately.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: How to do sf::Text always the same size, regardless window resizing
« Reply #3 on: December 24, 2012, 01:05:30 pm »
Quote
You can also inherit from RenderWindow and implement your own onResize method that'll automatically resize the current view
This is an undocumented internal detail that may change in the future.
Laurent Gomila - SFML developer

FRex

  • Hero Member
  • *****
  • Posts: 1839
  • Not doing gamedev/using SFML lately
    • View Profile
    • Email
Re: How to do sf::Text always the same size, regardless window resizing
« Reply #4 on: December 24, 2012, 02:14:52 pm »
What does 'undocumented' mean and why would that be changed?
I'm not using SFML nor doing any gamedev lately.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: How to do sf::Text always the same size, regardless window resizing
« Reply #5 on: December 24, 2012, 02:23:23 pm »
Quote
What does 'undocumented' mean
It means that it's not documented anywhere :P because it's an implementation detail that is not part of the public API, and on which users should not rely.

Quote
why would that be changed?
It's an implementation detail, therefore I can touch it without breaking the API compatibility between minor versions of SFML.

Because a member (function) can be accessed doesn't mean that it should be used. Users should strictly stick to what's publicly documented.
Laurent Gomila - SFML developer

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6275
  • Thor Developer
    • View Profile
    • Bromeon
Re: How to do sf::Text always the same size, regardless window resizing
« Reply #6 on: December 24, 2012, 02:26:11 pm »
It means that it's not documented anywhere :P because it's an implementation detail that is not part of the public API, and on which users should not rely.
Unfortunately, you do document it, see here. That makes it difficult to see what is part of the API.
« Last Edit: December 24, 2012, 02:40:57 pm by Nexus »
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

FRex

  • Hero Member
  • *****
  • Posts: 1839
  • Not doing gamedev/using SFML lately
    • View Profile
    • Email
I'm not using SFML nor doing any gamedev lately.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: How to do sf::Text always the same size, regardless window resizing
« Reply #8 on: December 24, 2012, 02:38:38 pm »
I don't document it, doxygen does ;D

I'll fix this, sorry.
Laurent Gomila - SFML developer

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6275
  • Thor Developer
    • View Profile
    • Bromeon
Re: How to do sf::Text always the same size, regardless window resizing
« Reply #9 on: December 24, 2012, 02:41:01 pm »
In the documentation, you can use the @internal command, so that Doxygen doesn't expose it to the API. The advantage over just using // instead of /// is that you can still create your own documentation where internal symbols show up.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: