SFML community forums

Help => Graphics => Topic started by: trilavia on December 24, 2012, 12:01:01 pm

Title: How to do sf::Text always the same size, regardless window resizing
Post by: trilavia on December 24, 2012, 12:01:01 pm
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
Title: Re: How to do sf::Text always the same size, regardless window resizing
Post by: Nexus on December 24, 2012, 12:12:17 pm
React to the Resized event and adjust your view accordingly.
Title: Re: How to do sf::Text always the same size, regardless window resizing
Post by: FRex 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.
Title: Re: How to do sf::Text always the same size, regardless window resizing
Post by: Laurent 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.
Title: Re: How to do sf::Text always the same size, regardless window resizing
Post by: FRex on December 24, 2012, 02:14:52 pm
What does 'undocumented' mean and why would that be changed?
Title: Re: How to do sf::Text always the same size, regardless window resizing
Post by: Laurent 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.
Title: Re: How to do sf::Text always the same size, regardless window resizing
Post by: Nexus 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 (http://www.sfml-dev.org/documentation/2.0/classsf_1_1RenderWindow.php). That makes it difficult to see what is part of the API.
Title: Re: How to do sf::Text always the same size, regardless window resizing
Post by: FRex on December 24, 2012, 02:27:33 pm
Did you undocument it after the RC? I found it here:
http://sfml-dev.org/documentation/2.0/classsf_1_1RenderWindow.php#a5c85fe482313562d33ffd24a194b6fef
Title: Re: How to do sf::Text always the same size, regardless window resizing
Post by: Laurent on December 24, 2012, 02:38:38 pm
I don't document it, doxygen does ;D

I'll fix this, sorry.
Title: Re: How to do sf::Text always the same size, regardless window resizing
Post by: Nexus on December 24, 2012, 02:41:01 pm
In the documentation, you can use the @internal (http://www.stack.nl/~dimitri/doxygen/commands.html#cmdinternal) 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.