Commit Graph

130 Commits

Author SHA1 Message Date
Chris Thrasher
b50f62da43 Test constexpr construction of aggregates 2024-07-27 17:27:39 -06:00
Chris Thrasher
c8c8673259 Pass sf::Vector2<T>s by value
As a rule of thumb, if the type is less than or equal to the CPU
register width times two then you ought to pass it by value. This
will lead to more efficient code generation.
2024-07-19 10:33:00 -06:00
Chris Thrasher
fbd8407a5f Enable moving windows 2024-06-30 16:50: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
kimci86
65c0a8183c Simplify Rect unit tests 2024-06-16 02:48:53 +02:00
kimci86
c371bc6816 Remove Rect getPosition and getSize methods 2024-06-16 02:48:53 +02:00
kimci86
7e5ed78219 Replace Rect members left, top, width, height by position and size 2024-06-16 02:48:53 +02:00
vittorioromeo
51efe50ec4 Simplify sf::Sprite implementation and reduce branches 2024-06-13 00:31:49 +02:00
Chris Thrasher
2f54312481 Fix documentation bugs 2024-06-12 14:38:04 -05:00
Chris Thrasher
304a7c1d69 Remove default empty state of sf::FileInputStream 2024-06-11 07:31:09 -05:00
Chris Thrasher
bfd65989e9 Remove default empty state of sf::Texture 2024-06-04 13:19:58 -06:00
Chris Thrasher
55f0918c62 Remove sf::View::reset in favor of assignment operations
It's rare that a type truly needs a .reset function. Copy/move
assignment typically accomplishes the same thing with less code
and is easier to maintain since it doesn't require updating your
.reset() function as new data members are added.

To reset a type is conceptually the same thing as simply assigning
from a newly constructed instance of the same type.
2024-05-26 10:23:52 -06:00
vittorioromeo
e53f4d62af Turn 'ContextSettings' into an aggregate and update usages 2024-05-25 00:56:37 +02:00
Chris Thrasher
fdcd899d2b Remove default empty state of sf::RenderTexture 2024-05-22 23:37:42 -06:00
Chris Thrasher
7234fc149b Remove default empty state of sf::Shader 2024-05-19 20:58:58 -06:00
Chris Thrasher
504b850f03 Remove default empty state of sf::Font 2024-05-19 14:01:54 -06:00
Chris Thrasher
0ac278b2d6 Remove default empty state of sf::Image 2024-05-19 13:25:34 -06:00
vittorioromeo
884206ce0c Store angles internally as radians 2024-05-14 13:07:40 -06:00
Chris Thrasher
4315c3d290 Revert change to Drawable::draw function signature
This change was made in 359fe90 due to recommendations from tooling.
On its face this change makes sense since it removes a copy that
isn't always necessary. In practice it caused ergonomic issues due
to now being forced to make a copy of the render states when needed.

The performance gains of eliding this copy are unsubstantiated. We
have not done any profiling to measure its impact. For lack of such
measurements I'd rather err on the side of improved user experience.
If future benchmarks prove this copy is rather expensive then we
can reconsider removing it with that evidence in mind.
2024-04-18 13:18:49 +02:00
Chris Thrasher
efcfaf06fb Improve test coverage 2024-04-11 12:59:06 -06:00
Chris Thrasher
6eaf300918 constexpr-fy sf::priv::Vector4 2024-04-11 09:05:28 -06:00
Chris Thrasher
f1bdacb57f Add tests for sf::Glsl types 2024-04-10 20:39:20 -06:00
Chris Thrasher
4967a4c28f Add tests for sf::Texture::loadFromImage 2024-02-27 09:44:05 -07:00
vittorioromeo
23c26f9b70 Turn 'sf::Vertex' into an aggregate 'struct' 2024-02-19 16:44:06 +00:00
vittorioromeo
b552148e26 Header cleanup guided by IWYU 2024-02-09 12:52:23 +01:00
vittorioromeo
4ff70c87d3 Self-contained '.inl' headers + minor refactoring 2024-02-05 13:45:01 +01:00
Kipernal
eb07e1e6c5 Added support for stencil testing.
Co-authored-by: binary1248 <binary1248@hotmail.com>
Co-authored-by: Chris Thrasher <chrisjthrasher@gmail.com>
2024-01-29 08:13:14 -07:00
kimci86
0d3c7f1c32 Make VertexBuffer::Usage a scoped enumeration 2024-01-27 15:31:30 -07:00
kimci86
b496877c90 Make BlendMode::Factor and BlendMode::Equation scoped enumerations 2024-01-27 15:31:30 -07:00
Corentin Schreiber
ebf485737f Add texture coordinate type to sf::RenderStates 2024-01-25 23:45:00 -07:00
Chris Thrasher
a2c003b2b7 Add sf::State for specifying fullscreen or floating windows 2024-01-15 23:08:33 -07:00
Chris Thrasher
4346b9a8bc Remove unnecessary default destructor
sf::RenderWindow still inherits a virtual destructor from a base
class so there's no need to explicitly declare a virtual destructor.
I added a test to ensure this property was not broken.
2024-01-08 12:26:28 -07:00
binary1248
5a2f30c5ae Added support for scissor testing. 2023-11-20 11:01:33 -07:00
Chris Thrasher
08eca7c9a4 Default all sf::Font special member functions 2023-11-18 20:52:17 -07:00
Chris Thrasher
daa1efcf05
Add tests for various loadFromStream() functions 2023-11-16 10:03:29 -07:00
Chris Thrasher
9cb4a68c9a Test class templates with multiple template types 2023-11-15 12:07:31 -07:00
Chris Thrasher
d3a79e6282 Add sf::Rect<T>::getCenter() 2023-11-15 09:30:01 -07:00
Chris Thrasher
0d4c34cf9b Add tests for sf::Image::loadFromMemory 2023-11-15 10:55:07 +01:00
Chris Thrasher
d672b3504e Add more tests for sf::Shape 2023-11-05 15:46:49 -07:00
Chris Thrasher
5cf740fd93 Remove output parameter from sf::Image::saveToMemory 2023-10-28 17:58:21 -06:00
Chris Thrasher
0fcd1dd0f1 Add tests for sf::Image::loadFromFile failure 2023-10-27 19:21:36 -06:00
Chris Thrasher
fd2c42c7d1 Add tests for sf::Image::saveToMemory 2023-10-27 19:21:36 -06:00
Chris Thrasher
9a8ca3227f Add UBsan to CI 2023-10-27 16:36:38 -06:00
André Polomat
014366b84a Updated the test for the maximum antialiasing level of render texture
it returns 32 on my system, 64 should still be a reasonable value
2023-10-27 12:46:27 -06:00
Chris Thrasher
6aabb75bcf Fix sf::Image tests
Bitten by a copy pasta error. We can't test for exact pixel values
since jpeg compression changes pixel values slightly.
2023-10-21 12:44:51 -05:00
Chris Thrasher
1c037e1cba Add tests for sf::Image::saveToFile 2023-10-20 23:53:18 -05:00
Chris Thrasher
bb1a465e50 Add cppcoreguidelines-pro-type-member-init clang-tidy check
This marks another good step towards systematically rooting out
undefined behavior in the form of reading uninitialized memory.
2023-10-17 21:41:36 -05:00
Chris Thrasher
dbb87db026 Add more tests for sf::Text 2023-09-28 12:41:29 -06:00
Chris Thrasher
9dc2e541e8 Add clang-tidy modernize-return-braced-init-list check 2023-09-17 15:47:33 -06:00