Commit Graph

319 Commits

Author SHA1 Message Date
Chris Thrasher
dffdaa52a7 Pass sf::Colors by value 2024-07-31 09:25:21 -06:00
Chris Thrasher
b50f62da43 Test constexpr construction of aggregates 2024-07-27 17:27:39 -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
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
Chris Thrasher
b4c7e4a890 Stop running tests that sometimes hang indefinitely 2024-07-17 17:12:58 -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
fbd8407a5f Enable moving windows 2024-06-30 16:50:32 -06:00
Chris Thrasher
e1469aa8f2 Use [[nodiscard]] in more places 2024-06-27 15:12:15 -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
vittorioromeo
86c1a71a93 Remove default empty state of sf::Event 2024-06-23 19:11:10 +02:00
Chris Thrasher
6f5711e799 Decrease test precision to reduce flakey failures
Sometimes this job fails. Perhaps it needs to be resructured or
removed if we can't figure out how to make it more reliable.

https://github.com/SFML/SFML/actions/runs/9569223439/job/26381302304?pr=3106#step:21:137
2024-06-18 14:02:57 -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
e7b23ffcd1 Add timeout parameter to waitEvent 2024-06-14 15:00:46 +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
366b119963 Remove default empty state of sf::MemoryInputStream 2024-06-10 08:11:28 -05:00
Chris Thrasher
de8430bb29 Use std::optional rather than sentinel values 2024-06-09 20:48:55 -05:00
vittorioromeo
52ce862a00 Remove default empty state of sf::Music 2024-06-08 20:54:10 +02:00
Chris Thrasher
5484824948 Remove unnecessary static casts 2024-06-05 11:54:36 -06:00
Paul Meffle
92bba1ed6f Add support for raw mouse input 2024-06-04 13:24:10 -06: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
e9fadbbcb3 Remove default empty state of sf::InputSoundFile and sf::OutputSoundFile 2024-05-22 09:46:37 -06:00
Chris Thrasher
53ade4baf1 Remove default empty state of sf::Cursor 2024-05-21 01:09:09 -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
Chris Thrasher
add6422e6b Remove default empty state of sf::SoundBuffer 2024-05-19 13:09:38 -06:00
Lukas Dürrenberger
6766268f36 Use the SoundSource derived type specific status 2024-05-16 13:41:05 -06:00
Chris Thrasher
9722fb3724 Add tests for Audio module types 2024-05-16 12:06:21 -06:00
vittorioromeo
884206ce0c Store angles internally as radians 2024-05-14 13:07:40 -06:00
Chris Thrasher
593c4fe173 Replace C arrays with std::array 2024-05-14 12:47:19 -05:00
Chris Thrasher
0777ce5ead Update to Catch2 v3.6.0 2024-05-07 17:02:47 +00:00
binary1248
2386653bd3 Add GitHub actions support for running x86, x86_64 and arm64-v8a Android tests using an Android emulator. 2024-05-04 17:22:12 +00:00
trustytrojan
ca0a231b35 Add operator bool() to sf::Event for checking if the event type is not Empty 2024-05-03 22:50:59 +00:00
Chris Thrasher
59447dd8e5 Rewrite sf::Event API to improve type safety
This new API is built on top of std::variant. This allows us to
store many different event types in a space-efficient way and access
the active event type in a type-safe manner that eliminates the
categories of UB that are possible with unions.

Co-authored-by: kimci86 <kimci86@hotmail.fr>
2024-05-01 18:00:58 +00:00
Chris Thrasher
249caa2fb2 Require that variables are initialized 2024-04-27 19:20:52 +00:00
binary1248
34fde883b9 Replaced OpenAL with miniaudio.
Co-authored-by: Chris Thrasher <chrisjthrasher@gmail.com>
Co-authored-by: kimci86 <kimci86@hotmail.fr>
Co-authored-by: vittorioromeo <mail@vittorioromeo.com>
2024-04-25 10:24:11 +02: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
d6e1961112 Ensure struct data members are given an initial value
While I don't suspect there are any uninitialize variable bugs
present, it's still good to err on the side of safety and provide
an initial value nonetheless.
2024-04-16 19:14:38 -06:00
Chris Thrasher
95a23c2d05 Add type trait tests for sf::SoundFileWriter
Other Audio module types get this same treatment so we ought to
also have a .test.cpp for this header.
2024-04-16 17:05:42 -06:00
Chris Thrasher
cb651c063c Add tests for sf::SoundFileReader 2024-04-16 17:05:42 -06:00