Commit Graph

313 Commits

Author SHA1 Message Date
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
Chris Thrasher
3ea228434b Build Cocoa example even when not using Xcode 2024-04-06 00:18:34 +02:00
vittorioromeo
23c26f9b70 Turn 'sf::Vertex' into an aggregate 'struct' 2024-02-19 16:44:06 +00:00
Elijah Hopp
f2b7364611 Reflect account name change in asset_licenses.md. 2024-02-13 23:31:47 +00:00
vittorioromeo
b552148e26 Header cleanup guided by IWYU 2024-02-09 12:52:23 +01:00
vittorioromeo
ee13dfbd3b 'SoundFileFactory' implementation overhaul 2024-02-05 17:11:23 +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
a019b5167b Make Shader::Type a scoped enumeration 2024-01-27 15:31:30 -07:00
Miron Alexandru
3ca42c9a45 Update copyright year 2024-01-26 12:00:22 -07:00
Chris Thrasher
ef5ee38576 Refactor ternary into early-returning conditionals
A complex ternary expression here doesn't buy us anything. This
refactor more clearly expresses what is going on in this function.
2024-01-17 19:14:27 -07:00
Chris Thrasher
30a986e632
Use CMake-standard <PackageName>_ROOT variable to locating config module
https://cmake.org/cmake/help/v3.22/command/find_package.html
https://cmake.org/cmake/help/v3.22/variable/PackageName_ROOT.html#variable:%3CPackageName%3E_ROOT

SFML_DIR predates the existence of <PackageName>_ROOT which is now
the preferred way to specify where to find a given package's config
module. User reports have shown that SFML_DIR may be broken at least
in certain circumstances so lets stop mentioning it.
2024-01-16 13:10:58 -07:00