Commit Graph

935 Commits

Author SHA1 Message Date
ZXShady
eeef7f9e02 Remove unnecessary friend declarations
These functions do not access any private functions they do not need to be `friend`ed
2024-10-06 13:08:22 -06:00
ZXShady
5ed16195b3 Use correct iterator comparison
Switching the iterator comparison used lowers the requirement for
iterators from *RandomAccessIterators* to *ForwardIterators*, which is a
benefit. It is also more accurate; instead of saying "if `begin` is less
than the end, stop." it states "if `begin` is not equal to end, stop."

Additionally, the old '<' did not protect us from undefined behavior because it is
undefined to compare two iterators relationally that are not:

1. past the end
2. within the array
2024-10-06 11:36:00 -06:00
ZXShady
72207a63ef Use inherited constructors instead of constructor delegation
sf::Exception can use the inheriting constructors functionality instead of a constructor delegating to the parent constructor.

I removed Exception.cpp as it is not needed anymore.
2024-10-05 10:22:49 -06:00
Lukas Dürrenberger
ecb945b341 Use explicit constructors when implicit construction isn't wanted 2024-10-03 22:43:57 -06:00
vittorioromeo
816855d13f Remove sf::Vector2<T>::Unit[XY] 2024-10-03 20:51:09 -06:00
ZXShady
de9286c11f Use explicit conversion operator instead of explicit constructor
I also added a type trait test to check whether the conversion operator is marked explicit.

this change has the advantage of being  clearer imo as it is a conversion operator for conersions not a constructor.

and also it allows users to take the address of convesion operator which I don't know if someone might find that useful.
2024-10-02 00:15:54 +02:00
ZXShady
c8dbd65ff5 use if constexpr instead of a switch statement
The condition is a constant expression, it makes more sense here to use `if constexpr`
2024-10-01 00:00:48 -06:00
vittorioromeo
37de949d87 Actually, don't define 2024-09-30 23:15:18 -06:00
ZXShady
71594d402e delegate to operator equals in operator not equals 2024-09-30 09:03:35 -06:00
Lukas Dürrenberger
6591c59504 Add window create functions without style specifier
This brings the create() functions inline with the constructor overloads
for WindowBase, Window, and RenderWindow
2024-09-16 12:05:59 -04:00
Lukas Dürrenberger
8ff95f7a5e Add the missing ChannelMap to the example code 2024-09-14 09:11:16 +02:00
Chris Thrasher
44b5237148 Fix out of date documentation code 2024-09-12 14:37:07 -06:00
Vittorio Romeo
9c3fcd72d0 Use gender-neutral language in comments 2024-09-12 17:37:10 +02:00
Lukas Dürrenberger
016e201d17 Use backticks for SFML types in doc comments 2024-09-11 16:02:01 -06:00
Chris Thrasher
2b4a72ee06 Fix more outdated references to Mac OS X 2024-09-09 23:42:26 -06:00
Lukas Dürrenberger
9f52cfec39 Change spelling of anti-aliasing 2024-09-09 18:37:00 -06:00
Lukas Dürrenberger
265a0cb03f Rename Vector2 & Vector3 functions to better fit the naming convention 2024-09-08 12:09:32 -06:00
Chris Thrasher
b55327b5b9 Remove unused header 2024-08-31 16:46:47 -06:00
Chris Thrasher
a7f7026804 Fix Doxygen warning 2024-08-31 12:02:59 -06:00
ZXShady
44339c3d67 Fix event handling stack corruption on MSVC 2024-08-30 14:52:48 -06:00
Chris Thrasher
27943ea774 Disallow constructing sf::String from std::nullptr_t 2024-08-30 09:55:55 -06:00
Chris Thrasher
4a463ec136 Throw custom sf::Exception type 2024-08-25 12:17:49 -06:00
Chris Thrasher
7d1d630457 Reimplement event assertions to loosen constexpr restrictions on event subtypes
Co-authored-by: Vittorio Romeo <vittorio.romeo@outlook.com>
2024-08-21 14:16:09 -06:00
Lukas Dürrenberger
fa9f991686 Mark standard library types as code in doc strings 2024-08-15 13:56:14 +01:00
Michal Tabaszewski
8096ba24fc Rename getLoop() to isLooping() and setLoop() to setLooping() 2024-08-08 15:01:28 -06:00
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
Chris Thrasher
dffdaa52a7 Pass sf::Colors by value 2024-07-31 09:25:21 -06:00
ZXShady
8c895fd7e1 Pass sf::IpAddress by value
`sf::IpAddress` is a wrapper around `std::uint32_t` and should be passed by value
2024-07-27 15:53:03 -06:00
ZXShady
a256c5cdcd
Remove useless attributes from implementation files (#3175) 2024-07-21 22:50:00 -06:00
Chris Thrasher
b0b4c7ff3d Fix documentation regarding bit widths 2024-07-21 17:52:58 -06:00
Chris Thrasher
0831f055ce Require that sf::WindowBase::handleEvents receives at least one argument 2024-07-21 11:59:05 -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
ZXShady
6c415471d2 Apply changes
Putting the `= default` in the header file like other files do and not in the `.inl` implementation files for consistency
2024-07-18 14:16:27 -06:00
Chris Thrasher
7083b6562e Fix typos 2024-07-15 14:16:36 -06:00
kimci86
72eb115551 Remove inheritance in sf::Event subtypes
This avoids confusing auto-completion hints when looking for an event
subtype to use as `sf::Event::is` or `sf::Event::getIf` type parameter.

This also avoids the inconsistency between what is possible with
`sf::Event::is` and `sf::Event::getIf` functions (they do not accept
event subtypes parents) and what would be possible with
`sf::Event::visit` (it could take a handler for a parent type).
2024-07-15 12:20:35 -06:00
vittorioromeo
7ba672139c Simplify sf::WindowBase::handleEvents and add basic tests 2024-07-09 17:51:41 +02:00
binary1248
41c48a84bc Added visitation support to Event and WindowBase via handleEvents. 2024-07-08 15:16:20 -06:00
Chris Thrasher
5873a7a157 Fix null pointer dereference when creating fullscreen window
Regression introduced in 7556d1b
2024-07-08 13:12:17 -06:00
Lukas Dürrenberger
121fa9cf74 Revert "Simplify/optimize sf::AudioResource implementation"
This reverts commit cede2def8b as it's
still possible to force a wrong destruction order.
2024-07-04 22:05:28 +02:00
Chris Thrasher
fbd8407a5f Enable moving windows 2024-06-30 16:50:32 -06:00
Chris Thrasher
7556d1be78 Move fullscreen window bookkeeping to a lower level 2024-06-30 16:50:32 -06:00
Chris Thrasher
51b8b44e14 Use more [[nodiscard]] 2024-06-27 19:02:46 -06:00
Chris Thrasher
e1469aa8f2 Use [[nodiscard]] in more places 2024-06-27 15:12:15 -06:00
Chris Thrasher
d7eeaea240 Add clang-tidy readability-else-after-return check 2024-06-27 12:17:03 -06:00
binary1248
be63ffa8d4 Fixed SoundEffects example allocating effect processor resources based on source channel count instead of engine channel count. 2024-06-27 08:17:23 +02:00
vittorioromeo
6ab03cc3ee Improve sf::Event documentation and parameter naming 2024-06-25 14:54:41 -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
7034e40ccc Document missing parameter 2024-06-24 14:14:08 -06:00
Vittorio Romeo
cede2def8b Simplify/optimize sf::AudioResource implementation 2024-06-24 15:27:34 +02:00