Commit Graph

11 Commits

Author SHA1 Message Date
binary1248
e185f6d53e Replace factory functions with throwing constructors 2024-08-08 09:19:32 -06:00
binary1248
698f265277 (Re-)Introduce default constructors and load/open member functions for resource objects that can be reused. 2024-08-08 09:19:32 -06:00
kimci86
fca4fa1aa2 Rename Font::loadFromFile into Font::openFromFile
Similar renaming for Font::loadFromMemory and Font::loadFromStream.
The goal is to better express the need to keep the source available,
similar to Music::openFromFile for example.
2024-06-25 22:53:28 +02:00
Chris Thrasher
14cff7406f Disallow construction from const T&& 2024-06-23 16:55:37 -06:00
Chris Thrasher
504b850f03 Remove default empty state of sf::Font 2024-05-19 14:01:54 -06:00
vittorioromeo
b552148e26 Header cleanup guided by IWYU 2024-02-09 12:52:23 +01:00
Chris Thrasher
dbb87db026 Add more tests for sf::Text 2023-09-28 12:41:29 -06:00
Chris Thrasher
60dbed7e5e Add tests for sf::Text 2023-08-05 18:58:54 -06:00
kimci86
669d9f53bc Update Text constructor static assert to use correct parameters 2023-08-05 14:39:07 -06:00
Chris Thrasher
3f4bb1ae12 Prevent constructing sf::Text with a temporary sf::Font
By deleting this constructor overload, it fails to compile if
you pass a temporary font to this parameter slot. That includes
code like

  sf::Text text("", sf::Font());

but more importantly it prohibits code like this

  sf::Font getFont()
  {
    sf::Font font;
    // load a font...
    return font;
  }

  sf::Text text("", getFont());

The same idea can be applied to setFont() to prevent setting fonts
from a temporary.

Credit to Jonny for the idea

Co-authored-by: JonnyPtn <jonathan.r.paton@googlemail.com>
2023-01-06 10:21:00 -07:00
Jonny Paton
e4bffe5b84 Rename test files to be unique 2022-10-23 16:39:12 +02:00