Commit Graph

74 Commits

Author SHA1 Message Date
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
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
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
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
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
vittorioromeo
23c26f9b70 Turn 'sf::Vertex' into an aggregate 'struct' 2024-02-19 16:44:06 +00:00
vittorioromeo
b552148e26 Header cleanup guided by IWYU 2024-02-09 12:52:23 +01:00
kimci86
a019b5167b Make Shader::Type a scoped enumeration 2024-01-27 15:31:30 -07:00
kimci86
39da2b829c Make Keyboard::Key a scoped enumeration 2023-12-22 10:47:30 -06:00
Chris Thrasher
c3f69e5d64 Remove leading newlines 2023-11-29 15:54:38 -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
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
2c99b3343a Remove default sf::Text constructor 2023-04-05 09:54:56 -06:00
Chris Thrasher
f3aac01744 Use structured bindings 2023-04-05 09:44:10 -06:00
Chris Thrasher
a100f847d5 Replace std::rand with <random> 2023-03-07 13:23:12 -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
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
ff9c9131b3 Replace sf::Uint16 with std::uint16_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
4f52793f7d Run clang-format 2022-07-11 20:04:56 +02:00
Chris Thrasher
757cb36d30 Use <random> header 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
0785093ebc Use sf::Vector2<T> for numeric parameter pairs 2022-05-17 08:33:11 +02:00
Vittorio Romeo
a3b27b4a6d Use pre-increment when post-increment is not necessary 2022-02-17 00:39:35 +00:00
binary1248
359fe9088c Fixed warnings reported by LGTM and Coverity Scan. 2022-02-16 08:26:17 +01:00
Chris Thrasher
28f273b9c9 Add sf::Angle
Similar to sf::Time, sf::Angle provides a typesafe API for working
with angles and provides named functions for converting to and from
degrees and radians.
2022-02-08 22:52:37 +00:00
Chris Thrasher
79c2aadbcc Remove redundant 4-param sf::Rect<T> constructor 2022-01-06 20:04:03 +01:00
Vittorio Romeo
f6de7eca40 Use smart pointers to manage memory 2021-12-21 19:54:25 +01:00
Lukas Dürrenberger
3cd45a283b Merge branch '2.6.x' into feature/backmerge 2021-12-20 13:44:56 +01:00
kimci86
fbc866c5c9 Fix regression in shader example 2021-12-15 15:27:37 +01:00
Vittorio Romeo
e9e353a7b2 Remove redundant APIs taking '(x, y)' in favour of ones taking 'sf::Vector' 2021-12-15 11:22:46 +01:00
Vittorio Romeo
d12a2cd319 Use 'override' whenever possible instead of 'virtual' 2021-12-09 09:07:03 +01:00
Vittorio Romeo
87e84bc9e5 Minor modernization changes: 'nullptr', range-based 'for' loops, ... 2021-12-08 21:41:20 +00:00
Vittorio Romeo
2839f6b4d2 Use 'auto' where no information is lost 2021-12-08 19:14:31 +00:00
Vittorio Romeo
c9f7cb3d52 Use 'nullptr' instead of 'NULL' 2021-12-03 15:48:32 +00:00
Lukas Dürrenberger
bc628c6b28 Fix warnings in examples
- Convert where necessary
- Adjust type where reasonable
- Use SYSTEM headers for gl.h, stb* and vulkan
2021-11-30 11:25:58 +01:00
MrZeusTheCoder
20238e758e Switch example resources to public domain ones. 2021-04-02 22:16:22 +02:00
Mario Liebisch
146f63874a Added a geometry shader effect to the Shader example 2016-02-18 20:20:43 +01:00
Zachariah Brown
957cabb816 Added support for outlined text 2015-12-31 10:41:59 +01:00