Commit Graph

841 Commits

Author SHA1 Message Date
Chris Thrasher
04a7184ab4 Simplify sf::View construction 2023-12-11 19:33:20 -07:00
Chris Thrasher
e11154e7f7 Define default special member functions in headers 2023-12-10 10:28:42 -07:00
Chris Thrasher
7f5d87dcd5 Add move semantics to sf::Context 2023-12-09 10:27:57 -07:00
Chris Thrasher
c89c5eae69 Replace raw loops with standard algorithm 2023-11-28 09:41:28 -07:00
Chris Thrasher
c6919e28fc Prefer std::optional return types over output parameters 2023-11-28 09:37:03 -07:00
Chris Thrasher
0a1090c89d Let compiler define default constructors 2023-11-27 10:49:51 -05:00
Chris Thrasher
fca84e4011 Implicitly define default constructors 2023-11-20 21:31:40 -07:00
Chris Thrasher
1e4cdf89b6 Use std::array to reduce code duplication
std::array lets us have a single source of truth for array size
rather than needing separate constants or magic numbers that have
to stay in sync with the underlying array.
2023-11-20 12:14:21 -07:00
binary1248
5a2f30c5ae Added support for scissor testing. 2023-11-20 11:01:33 -07:00
Chris Thrasher
08eca7c9a4 Default all sf::Font special member functions 2023-11-18 20:52:17 -07:00
Chris Thrasher
ec50a7332b Fix sf::Rect docs 2023-11-15 15:58:01 -07:00
Chris Thrasher
d3a79e6282 Add sf::Rect<T>::getCenter() 2023-11-15 09:30:01 -07:00
Chris Thrasher
f588589089 Use inline to define constant in header 2023-11-10 00:24:39 -07:00
Chris Thrasher
dcfccbec6e Remove declaration of unimplemented function 2023-11-10 00:22:35 -07:00
Chris Thrasher
133bcda6cb Add more readability-identifier-naming rules 2023-11-05 15:05:25 -07:00
Chris Thrasher
5cf740fd93 Remove output parameter from sf::Image::saveToMemory 2023-10-28 17:58:21 -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
f98ff0d26a Assert against division by zero in public APIs
Yet another class of UB we can eliminate in debug builds.
2023-10-08 20:02:38 -06:00
Chris Thrasher
9dc2e541e8 Add clang-tidy modernize-return-braced-init-list check 2023-09-17 15:47:33 -06:00
Chris Thrasher
f9e6f673dd Fix references to sf::WindowBase::setMouseCursor
This function does exist in sf::Window via inheritence but it's
more accurate to refer to the base implementation in sf::WindowBase
2023-09-17 13:01:37 -06:00
Vittorio Romeo
5cfbf912c7 Do not ignore '[[nodiscard]]` functions in example code 2023-09-13 16:06:23 -06:00
Chris Thrasher
332d11be41 Add move semantics to sf::RenderTarget and sf::RenderTexture 2023-09-05 17:12:06 -06:00
Johel Ernesto Guerrero Peña
c596d6cf3f fix: use non-deprecated form of UDL declaration
Clang 18 issues a deprecation warning,
and is converted to an error with `-Werror`.
2023-08-28 14:25:54 -06:00
Chris Thrasher
1cca7cde7e Consistently use getNativeHandle function name 2023-08-27 16:52:00 -06:00
kimci86
635c8c9290 Make Sound::getBuffer return a reference
because the pointer now cannot be null
2023-08-27 16:46:52 -06:00
kimci86
9cbcd56eb8 Remove Sound default constructor
so that a Sound instance is always bound to a SoundBuffer
2023-08-27 16:46:52 -06:00
Chris Thrasher
63088c1bf1 Add tests for sf::SocketSelector
I added move semantics while I was at it
2023-08-27 16:46:05 -06:00
Chris Thrasher
b3a467678d Add tests for sf::Http
This class hides a lot of its logic in the private section of the
classes and uses friends to access them so there is little accessible
in the public interface for testing.
2023-08-27 16:46:05 -06:00
Chris Thrasher
71615c8268 Use struct for user defined type with no private section 2023-08-27 10:04:14 -06:00
Chris Thrasher
e5c41c4eb5 Enable move semantics for socket types 2023-08-26 22:17:34 -06:00
Chris Thrasher
733a0a8d6d Let compiler define extra special member functions 2023-08-05 18:58:54 -06:00
kimci86
3d2944998d Make Text::getFont return a reference
because a the m_font pointer cannot be null.
2023-08-05 14:39:07 -06:00
kimci86
623d0f67ea Make Sprite::getTexture return a reference
and do some simplification using the fact that a constructed sprite has
a non-null texture pointer.
2023-08-05 14:39:07 -06:00
Chris Thrasher
b99a4e341e Add Android clang-tidy job 2023-07-31 15:28:25 -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
Johel Ernesto Guerrero Peña
ac2e4d49cf docs: add missing braces to initialize vector 2023-07-16 17:43:59 -06:00
Johel Ernesto Guerrero Peña
00b6488c3e
Add missing #includes 2023-07-13 17:37:45 -06:00
Chris Thrasher
98df0fe4c9 Add doc strings to remaining assertions 2023-07-10 15:03:01 -06:00
Erik Bolumburu
a143da5f52 Added assert messages to Vector3 functions 2023-06-30 11:13:50 +02:00
Erik Bolumburu
b8ca0f6523 Added asserts for cwiseDiv() 2023-06-28 22:34:20 +02:00
Shane Whitmire
b391be2316 Make glyph a struct
This glyph class should most definetely be a struct. There aren't any
functions into it. This PR is more of a philosophy question than
anything else. I think we should make an argument for and against here
too.
2023-06-27 12:34:27 +02:00
MetGang
8835f42589 Make sf::Clock pausable 2023-06-02 11:32:04 -06:00
binary1248
b39be46db0 Moved most variables in sfml-graphics, GlResource and GlContext out of namespace scope. 2023-06-02 10:22:48 -06:00
Chris Thrasher
53e2fab582 Prefer named colors 2023-05-25 17:08:42 -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
33030e94d9 Use std::byte 2023-05-21 02:21:44 -06:00
Ted Lyngmo
9855552f64 Add sf::Shape::getGeometricCenter()
This adds

    virtual Vector2f getGeometricCenter() const = 0;

Signed-off-by: Ted Lyngmo <ted@lyncon.se>
2023-05-15 16:13:39 -06:00
Ted Lyngmo
f95d159711 Fix build failure when using g++ (GCC) 13.1.1
This fixes #2550

Signed-off-by: Ted Lyngmo <ted@lyncon.se>
2023-05-15 10:34:34 -06:00
Chris Thrasher
b14d0b47e6 Fix broken sf::swap overloads 2023-05-13 12:20:44 -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
BlackyDrum
c2e065b9bc Fix typo in 'Http.hpp' 2023-04-29 16:34:24 -06:00
Chris Thrasher
92dbac623b Document precision limitation of sf::sleep 2023-04-28 15:01:11 -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
alireza
5480bf8a93
Fixed move semantics for sf::Cursor and added test for it 2023-04-22 18:29:05 +02:00
Jan Wojciechowski
692fe84331 Fix condition for trailing bytes count in UTF-8 decoder. Test added to check if a replacement characters is added to output. 2023-04-19 23:52:38 +02:00
vittorioromeo
230c6a4d57 Simplify 'FontHandles' management 2023-04-19 16:32:49 +01:00
Chris Thrasher
82b9821a8a Add clang-tidy bugprone-* checks 2023-04-12 19:53:36 -06:00
Chris Thrasher
2c99b3343a Remove default sf::Text constructor 2023-04-05 09:54:56 -06:00
Chris Thrasher
f371a99b39 Implement sf::String in terms of std::u32string 2023-04-04 15:47:34 -06:00
Chris Thrasher
93a8506498 Let compiler generated special member functions 2023-04-04 15:47:34 -06:00
Chris Thrasher
14dbd3c899 Remove old workaround for MinGW's lack of unicode support
Dates back to 2009 when 78247bd38 was written. I'm going to assume
the situation has improved in the last 14 years. There are SFML
users who weren't even alive in 2009...
2023-04-03 21:23:43 -06:00
Chris Thrasher
06c5c50537 De-constexpr sf::String::InvalidPos
This fails to link on MinGW. Until that can be resolved we can go
back to a normal constant. Because this is just an integer it doesn't
matter all that much whether it's const or constexpr.
2023-04-03 21:23:43 -06:00
Chris Thrasher
92e5a1e4e6 Implement move semantics for sf::Cursor 2023-04-03 01:02:26 -06:00
Jim-Marsden
a8bc8cf889 Added move constructor, and move assignment operator. 2023-03-29 23:48:05 +02:00
binary1248
f4e0c4b4c0 Make moving Shapes, swapping Textures and swapping VertexBuffers noexcept. 2023-03-07 16:32:35 -07:00
metaquarx
474de4d16e Allow setting window icon with sf::Image 2023-02-21 15:48:33 -07:00
Vittorio Romeo
698b7ee49f Remove unused headers and reduce physical dependencies 2023-02-20 23:30:25 +01:00
Chris Thrasher
5bd3722598 Fix sf::Rect docs 2023-02-19 17:40:03 -07:00
Chris Thrasher
949d9f44e1
Simplify implementation of sf::Clock 2023-02-11 14:02:22 -07:00
tverrbjelke
7074849814 Fixes Typo in documentation of WindowBase
modified:   include/SFML/Window/WindowBase.hpp
2023-01-25 10:07:16 -07:00
Andreas Hüwel
8737bbe970 Fixses mostly unimportant typo in documentation of WindowBase
modified:   include/SFML/Window/WindowBase.hpp
2023-01-25 10:07:16 -07:00
Chris Thrasher
9f08d67dcc Convert scancodes into a scoped enumeration 2023-01-25 10:06:03 -07:00
Chris Thrasher
72cd8781bb Remove deprecated keycodes 2023-01-25 10:06:03 -07:00
Norm Evangelista
4c8b770992 Replaced anonymous enums with constexpr per #2328
Addressed review comments


Addressed review comments


Changed NOLINTBEGIN/END to NOLINTNEXTLINE


Addressed CI complaint


Fixed BSD CI issues
2023-01-24 16:15:16 -07:00
Norm Evangelista
9b1b0f5b07 Streamlined readability-* clang-tidy checks
Addressed CI complaints

Addressed review comments, CI issues

Reverted files exempted from linting

Fixed missing comma

Fixed clang-format escape

Disabled spurious readability-non-const-parameter

Addressed review comment

Moved NOLINT inside namespace per review

Remove const from function argument decls


Fixed rebase and formatting issues


Fixed macOS CI issues
2023-01-22 17:00:25 -07:00
Chris Thrasher
b48f4b70a7 Export StreamDeleter symbols
We're unsure why this is necessary but it satisfies a linker error
2023-01-22 15:50:53 -07:00
Chris Thrasher
dd83189fae Enable move semantics for SoundFile types
Funny how the addition of a forward declaration resulted in
accidentally disabling move semantics for two types. We ought to
be careful that build time improvements don't have runtime
performance impacts.
2023-01-22 15:50:53 -07:00
Chris Thrasher
6ea07b810c Let compiler implicitly delete copy operations
Because this class is implemented with unique pointers, copy semantics
are implicitly deleted. This can be verified by the type trait tests
which continue to affirm that these types are noncopyable.
2023-01-22 15:50:53 -07:00
Lukas Dürrenberger
d9f8df9ca0 Merge branch '2.6.x' into master 2023-01-21 10:17:18 +01:00
kimci86
752955c6f8 Rename Key::Tilde to Key::Grave 2023-01-20 16:32:59 +01:00
kimci86
914ae374ff Silence clang warnings about Scancode enumeration 2023-01-20 16:32:59 +01:00
kimci86
b354f7f7ee Scancode renaming leftover 2023-01-20 16:32:59 +01:00
Lukas Dürrenberger
5dbe85bfec Use a nested struct instead of a prefix 2023-01-20 16:32:59 +01:00
Lukas Dürrenberger
39b8d67262 Align and fix mappings and general logic
- Aligned mappings
  - ScanDash -> ScanHyphen
  - Numpad keys include Numpad
  - *Equals -> *Equal
  - Key 29/42 are Backslash
  - Key 45 is Non-US Backslash
  - Add additional media & more scancodes
  - Rename ScanAgain to ScanRedo
  - Rename ScanMute to ScanVolumeMute
  - Add the missing F-key mappings for macOS
  - Fix mapping in Windows code
  - Correctly handle numpad keys on Windows for isKeyPressed
- Refactorings
  - Use mapping for Linux from different key config
  - Refactor some mapping code
  - Fix map initialization
  - Layout independent keys also don't have unicode characters, so it
    makes more sense to translate them first and use unicode as fallback
  - Fix iteration limits on Windows
  - Consistently use 'Scancode' instead of 'ScanCode' everywhere
  - Use 'delocalize' instead of 'unlocalize'
  - Fix conversion warnings
  - Remove unused mapping function
  - Hide parameters for non-applicable iOS functions
- Update documentation
- Add Android InputImpl scancode function stubs
2023-01-20 16:32:59 +01:00
jonathan.r.paton@googlemail.com
a34d48c42d Initial Windows implementation 2023-01-20 16:32:59 +01:00
Marco Antognini
34197ba5b5 Add new API for scancodes 2023-01-20 16:32:59 +01:00
Lukas Dürrenberger
b191a0dc58 Use Scan prefix instead of 's'
Also use getDescription instead of localizedRepresentation
2023-01-20 16:32:59 +01:00
Marco Antognini
75ef99e2ca Add new API for scancodes 2023-01-20 16:32:59 +01: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
Nikita
1f0167192b
Update to year 2023 2023-01-12 11:38:41 +01:00
Chris Thrasher
badb388507 Remove unnecessary casts 2023-01-11 15:30:22 -07:00
Chris Thrasher
cdce9f7147 Use nested namespaces 2023-01-07 11:28:36 -07:00
Chris Thrasher
098f6927d2 Prevent using a temporary sf::SoundBuffer with sf::Sound 2023-01-06 15:46:22 -07:00
Chris Thrasher
2d0c923a53 Prevent using a temporary sf::Texture with sf::Shader 2023-01-06 15:46:22 -07:00
Chris Thrasher
0c2f7da9f9 Prevent using a temporary sf::Texture with sf::Sprite 2023-01-06 15:46:22 -07:00