Commit Graph

324 Commits

Author SHA1 Message Date
vittorioromeo
516bd313a4 Comparison benchmark 2024-09-14 03:25:45 +02:00
Chris Thrasher
eeb43e4747 Use sf::Vector3f to simplify Vulkan example 2024-09-12 15:18:44 -06:00
Vittorio Romeo
9c3fcd72d0 Use gender-neutral language in comments 2024-09-12 17:37:10 +02:00
Chris Thrasher
ab109cd3cd Use ON and OFF for CMake booleans
CMake supports a number of strings for truthy and falsey values.
ON/OFF and TRUE/FALSE are the most popular but 1/0 is also supported.
This is mostly a style choice but I'm inclined to believe that ON/OFF
is the most popular option and I'm generally in favor of style
choices that better align with the community at large.
2024-09-11 14:36:13 -06:00
Lukas Dürrenberger
265a0cb03f Rename Vector2 & Vector3 functions to better fit the naming convention 2024-09-08 12:09:32 -06: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
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
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
7083b6562e Fix typos 2024-07-15 14:16:36 -06:00
Bambo-Borris
5eb57ae5f1 Fix white square problem in OpenGL example
Because the sf::Texture::m_texture value changes when the texture is
reloaded from disk, we need to rebind the texture since the previously
bound sf::Texture::m_texture value is no longer a valid identifier.
2024-07-15 12:32:08 -06:00
binary1248
85e5ce5d65 Added event handling example. 2024-07-08 15:16:20 -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
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
vittorioromeo
86c1a71a93 Remove default empty state of sf::Event 2024-06-23 19:11:10 +02:00
Chris Thrasher
735f2d972d Replace sentinel values with std::optional 2024-06-18 12:35:29 -06:00
kimci86
58e83056bb Some simplifications taking advantage of Rect position and size members 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
Chris Thrasher
304a7c1d69 Remove default empty state of sf::FileInputStream 2024-06-11 07:31:09 -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
vittorioromeo
e7d67cfa2a More Shader.cpp example simplifications 2024-06-07 17:43:54 +02:00
vittorioromeo
dae09a912c Rewrite Shader.cpp example 2024-06-07 01:01:11 +02:00
Chris Thrasher
5484824948 Remove unnecessary static casts 2024-06-05 11:54:36 -06:00
Paul Meffle
1e1c13b51d Add example raw_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
binary1248
59414d5bfd Restore Shader and Island examples back to equivalent pre-API-change functionality. 2024-05-30 12:53:11 -06:00
binary1248
123270f7ad Added support for retrieving a list of audio playback devices, getting the default audio playback device and changing the audio playback device during runtime. 2024-05-28 10:54:01 -06:00
vittorioromeo
e53f4d62af Turn 'ContextSettings' into an aggregate and update usages 2024-05-25 00:56:37 +02:00
Chris Thrasher
eb4170796a Fix geometry shader example
This example is optional since it may be skipped on hardware where
geometry shaders are not supported. The way I rewrote it in 7234fc1
resulted in the shader still being attempted to be loaded even when
geometry shaders were not supported leading to the whole program
crashing.

My bad.
2024-05-23 14:34:57 -06: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
Chris Thrasher
add6422e6b Remove default empty state of sf::SoundBuffer 2024-05-19 13:09:38 -06:00
binary1248
002b8953fa Added support for user defined sound effect implementations. 2024-05-16 21:52:16 -06:00
Vittorio Romeo
a61eb6aeef Do not use 'sf::err' in examples 2024-05-14 21:08:09 -06: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
kimci86
bdd348c142 Make Sound::Status a scoped enumeration 2024-04-28 16:36:57 +00:00
Chris Thrasher
04c36fdd1a Improve const correctness 2024-04-27 23:33:52 +00:00
Chris Thrasher
249caa2fb2 Require that variables are initialized 2024-04-27 19:20:52 +00:00
binary1248
c0ca39ed21 Added Sound Effects example. 2024-04-25 10:24:11 +02: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
ebf916edf8 Refactor ternary into early-returning conditionals
Continuing precedent set in ef5ee38
2024-04-23 10:57:44 -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
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