Commit Graph

335 Commits

Author SHA1 Message Date
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
Chris Thrasher
a2c003b2b7 Add sf::State for specifying fullscreen or floating windows 2024-01-15 23:08:33 -07:00
Chris Thrasher
2fe58c66a7 Delete unnecessary destructor 2023-12-26 22:14:57 -06:00
Chris Thrasher
36e7a18881 Fix clang-tidy errors 2023-12-23 10:41:02 -06:00
Chris Thrasher
a1c3aa14cb Remove redundant link libraries
This is the warning I got when building this locally

ld: warning: ignoring duplicate libraries: 'lib/libsfml-graphics-s-d.a', 'lib/libsfml-system-s-d.a', 'lib/libsfml-window-s-d.a'
2023-12-22 23:16:45 -06:00
Chris Thrasher
f5497b2db6 Use more in-class member initializers 2023-12-22 21:55:51 -06:00
Chris Thrasher
3d4ea00135 Use sf::Vector2<T> conversion constructor 2023-12-22 20:32:08 -06:00
kimci86
39da2b829c Make Keyboard::Key a scoped enumeration 2023-12-22 10:47:30 -06:00
Chris Thrasher
2bc4e15043 Fix typos 2023-12-17 15:48:19 -07:00
Chris Thrasher
c3f69e5d64 Remove leading newlines 2023-11-29 15:54:38 -07:00
Chris Thrasher
2fcdec5153 Remove unnecessary reinterpret_casts 2023-11-26 18:08:02 -05:00
Chris Thrasher
27acbab3d9 Use sf::Rect<T>::getCenter() in more places 2023-11-20 16:01:36 -07:00
Bruno Van de Velde
0da4382d6c Android example no longer needs to search Audio and Network modules as they are no longer being linked 2023-11-15 17:29:42 -07:00
Bruno Van de Velde
025a9ddc53 Removed sfml-activity which is no longer needed to bootstrap Android applications 2023-11-15 17:29:42 -07:00
Bruno Van de Velde
4d65844978 Modernized android example
- Replaced ndk-build with CMake
- Updated Groovy DSL (.gradle files) to Kotlin DSL (.gradle.kts files)
- Updated Android Gradle plugin from 3.0 to 7.4
- Config file now targets a more recent Android SDK (and NDK)
- Remove deprecated settings from AndroidManifest
2023-11-14 16:04:30 -07:00
Chris Thrasher
b16114fa23 Replace std::memcpy with a more expressive alternative 2023-11-10 00:24:51 -07:00
Chris Thrasher
133bcda6cb Add more readability-identifier-naming rules 2023-11-05 15:05:25 -07:00
Chris Thrasher
7c8d1b5332 Use more sf::Vector operations
When dealing with calculations that are fundamentally two dimensional
it's helpful to use a 2D data type as much as possible rather than
decomposing the calculations into x and y components. The more we use
vector operations the better chance we have of easiliy reasoning about
what the code is doing.
2023-10-31 19:45:13 -06: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
d6c18af926 Use cross-platform threading library target 2023-09-24 20:57:33 -06:00
Chris Thrasher
9dc2e541e8 Add clang-tidy modernize-return-braced-init-list check 2023-09-17 15:47:33 -06:00
Chris Thrasher
b68482754b Use std::filesystem::path for paths 2023-07-27 11:13:45 -06:00
Chris Thrasher
ddfb7f6cb0 Use modern name for macOS
In a few places I left references to the old name where appropriate.
There are also many CMake references to "OSX" that we have to keep
using since CMake does not offer alternative names for those variables
and target properties.
2023-07-24 21:25:26 -06:00
Chris Thrasher
98df0fe4c9 Add doc strings to remaining assertions 2023-07-10 15:03:01 -06:00
Chris Thrasher
d131beb0fd Fix misspellings
I used the Python tool codespell to find these
2023-05-21 14:37:46 -06:00
Chris Thrasher
fe2ca0b82e Fix clang-tidy-16 failures 2023-05-21 11:59:52 -06:00
Chris Thrasher
27249d42ed Add sf::WindowBase::set{Min|Max}imumSize()
Co-authored-by: Shane Whitmire <dogunbound5@gmail.com>
Co-authored-by: michael.david.howard@outlook.com <michael.david.howard@outlook.com>
2023-05-12 14:36:06 -06:00
Chris Thrasher
fb1cfdc48d Add misc-const-correctness clang-tidy check 2023-05-04 16:22:03 -06:00
Chris Thrasher
29863b14a5 Remove default sf::Sprite constructor 2023-05-03 13:33:42 -06:00
vittorioromeo
cbfa9cbb65 Reorder includes hierarchically 2023-04-25 17:25:33 +02:00
Chris Thrasher
97c00d42ad Enable clang-tidy modernize-pass-by-value check 2023-04-24 15:12:53 +02:00
Chris Thrasher
2c99b3343a Remove default sf::Text constructor 2023-04-05 09:54:56 -06:00
Chris Thrasher
57a40c531f Be explicit about when new keys are added to the map 2023-04-05 09:54:56 -06:00
Chris Thrasher
f3aac01744 Use structured bindings 2023-04-05 09:44:10 -06:00
Jonny
741fe219da
Use built-in CMake support for iOS
* Use built-in iOS support for cmake and expand tests to cover more configurations
* Adjust CI builds
* Update examples version

---------

Co-authored-by: Chris Thrasher <chrisjthrasher@gmail.com>
2023-04-03 23:36:33 +02:00
Chris Thrasher
a100f847d5 Replace std::rand with <random> 2023-03-07 13:23:12 -07:00
Chris Thrasher
eb162df723 Use X11's find module
Added in CMake 3.14 so this wasn't accessible in prior versions of
SFML
2023-02-06 15:12:58 -07:00
Thibaut PONCHON
642d981acf Replace std::strcmp by std::string_view::operator==
clang-format validation pass

Remove unecessary cstring include
2023-01-29 12:10:34 -07:00
Shiv
ca5ca65004
Removed return EXIT_SUCCESS and cstdlib 2023-01-23 10:00:48 +01:00
Norm Evangelista
144b336c17 Added readability-redundant-*, readability-simplify-* checks
Fixed CI complaints


Restored comment for clarity
2023-01-20 08:31:25 -07:00
Norm Evangelista
6ef8e487cc Added readability-qualified-auto, -redundant-access-specifiers
Fixed clang-format escapes

Fixed OSX clang-tidy issues

Collapsed extraneous lines

Fixed clang-format escape
2023-01-19 15:53:40 -07:00
Chris Thrasher
8a5b206bb8 Add clang-tidy modernize-use-default-member-init check 2023-01-18 08:03:10 -07:00
Norm Evangelista
3745ea2336 Added readability-container-size-empty, readability-isolate-declaration
FIxed Windows escapes for readability-* checks


Fixed Linux DRM readability-isolate-declaration escape


Fixed typo in fix :-|


Fixed clang-format issue
2023-01-16 21:45:33 +01:00
Norm Evangelista
a4bca20567 Added modernize-use-equals-default, modernize-use-equals-delete
Fixed formatting issues per review


Implemented copy constructor since operator= is implemented


Reverted operator=, add NOLINT for copy constructor per review


Fixed clang-tidy escape in examples


Fixed OSX clang-tidy escapes
2023-01-14 18:12:18 -07:00
Chris Thrasher
f0119145c2 Fix Windows clang-tidy errors 2023-01-14 15:13:02 -07:00
Nikita
1f0167192b
Update to year 2023 2023-01-12 11:38:41 +01:00
Norm Evangelista
39dd630f07 Added modernize-use-nullptr check
Addressed review comments


Fixed Vulkan.cpp clang-tidy issues


Used default-constructed objects instead of 0


More fun with OSX clang-tidy


Try casting a nullptr to see if clang-tidy can live with it


Revert "Try casting a nullptr to see if clang-tidy can live with it"

This reverts commit e217a1d8be45e3fd27dc73e1c7043be921d3830b.

Restored deleted line
2023-01-11 17:36:16 -07:00
Jim-Marsden
b2009e2fca Changed from std::scoped_lock to std::lock_guard 2023-01-11 15:07:29 -07:00
Shiv
9bdf207818
Use std::clamp 2022-12-27 17:58:49 -06:00
Jim-Marsden
7884efc49e Replaced Header Guards with Pragma Once 2022-12-27 20:08:11 +01:00
Chris Thrasher
3b6db4d18c Enforce variable case 2022-12-12 16:10:03 -07:00
Jonny
510068d501
Use enum class instead of plain enum for PrimitiveType (#2286)
Co-authored-by: Jean Tampon <jean.tampon@gmail.com>
2022-11-27 12:17:27 -07:00
Chris Thrasher
a5dbe59f07
Merge branch '2.6.x' 2022-10-13 14:33:11 -06:00
Chris Thrasher
7a5b862fd0 Consolidate redundant gl.h headers 2022-10-09 13:04:24 +02:00
Vittorio Romeo
753644a5bd Fix CMake formatting inconsistencies 2022-10-06 20:33:40 +02:00
kimci86
d0cf86d516 Fix minor inconsistency in type cast in voip example
because m_samples is a vector of Int16 values.
2022-10-01 19:51:48 +02:00
Chris Thrasher
34ee40c835 Use scoped enumerations in Network module 2022-09-27 17:30:13 +02:00
Jonny Paton
e01e4760e9 Fix cocoa example - some absolute paths needed in cmake, and float conversion to sf::Angle 2022-09-26 23:50:26 +02:00
Chris Thrasher
3a3935d005 Replace sf::Uint64 with std::uint64_t 2022-09-13 11:15:03 -06:00
Chris Thrasher
05690b963d Replace sf::Int64 with std::int64_t 2022-09-13 11:15:03 -06:00
Chris Thrasher
e294090c8e Replace sf::Uint32 with std::uint32_t 2022-09-12 15:36:55 -06:00
Chris Thrasher
056f66a2b8 Replace sf::Int32 with std::int32_t 2022-09-12 15:36:55 -06:00
Chris Thrasher
ff9c9131b3 Replace sf::Uint16 with std::uint16_t 2022-09-12 21:36:13 +03:00
Chris Thrasher
e21ae3204e Replace sf::Int16 with std::int16_t 2022-09-12 21:36:13 +03:00
Chris Thrasher
e2528de20a Replace sf::Uint8 with std::uint8_t 2022-09-09 10:28:53 +02:00
Chris Thrasher
82b48a7520 Use std::size_t 2022-09-07 22:23:22 +02:00
Chris Thrasher
72d88033e2 Use relative paths for resource files 2022-08-22 11:26:57 +08:00
Chris Thrasher
a71d60a0c9 Simplify how warnings are ignored on Apple platforms
Within files that are only compiled on Apple platforms, we don't
need that redundant check for __APPLE__ so that got removed. Further,
Clang will recognize GCC pragmas so we don't need both Clang AND GCC
pragmas so I removed the Clang pragmas.

Currently GCC fails to compile this code but if one day in the future
that gets fixed, the deprecation warnings will continue to get ignored.
2022-08-03 23:41:01 +02:00
friendlyanon
e691033954 Require CMake 3.16 for ObjC and ObjC++ sources
Both languages gained native CMake support in 3.16:
https://cmake.org/cmake/help/latest/release/3.16.html#languages
2022-08-03 23:38:17 +02:00
Chris Thrasher
55a1a2a4c4 Format .m files 2022-07-14 21:47:49 +02:00
Chris Thrasher
4f52793f7d Run clang-format 2022-07-11 20:04:56 +02:00
metaquarx
88e9f82bee Add '.clang-format' file, CI integration, and formatting exceptions
Co-authored-by: Vittorio Romeo <vittorio.romeo@outlook.com>
Co-authored-by: Chris Thrasher <chrisjthrasher@gmail.com>
Co-authored-by: kimci86 <kimci86@hotmail.fr>
2022-07-11 20:04:56 +02:00
Vittorio Romeo
8c8d97c6c9 IpAddress is always valid 2022-06-28 00:31:12 +02:00
Chris Thrasher
0812054e02 Remove trailing whitespace 2022-06-25 21:32:55 +02:00
Chris Thrasher
757cb36d30 Use <random> header 2022-06-16 23:56:39 +02:00
Chris Thrasher
65fef85b30 Simplify how examples are built
CMake doesn't require absolute paths so we can safely remove
SRCROOT and let implicit relative pathing achieve the same result
with less work on our part.
2022-06-16 23:56:39 +02:00
Chris Thrasher
539483d329 Use std::array 2022-06-16 23:56:39 +02:00
Chris Thrasher
dbac180db5 Limit the scope of event object 2022-06-08 13:16:40 +02:00
Chris Thrasher
88515b2fca Add polar coordinates constructor for sf::Vector2<T> 2022-05-17 20:30:02 +02:00