Add sf::State for specifying fullscreen or floating windows#2818
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #2818 +/- ##
==========================================
+ Coverage 42.97% 43.02% +0.04%
==========================================
Files 252 252
Lines 21099 21113 +14
Branches 5172 5177 +5
==========================================
+ Hits 9067 9083 +16
+ Misses 11221 11093 -128
- Partials 811 937 +126
... and 13 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
|
Exploiter and I talked about whether the order of |
3326083 to
c033e61
Compare
|
Rebased on |
Since it's more likely you want to adjust |
|
While I didn't fully realize or verbalize in the past discussion, I think the main issue is, that you currently have to set a style for fullscreen window, even though the fullscreen window won't have a style. Currently asking myself if we just need another overload |
|
Maybe it goes a bit into off-topic (we can gladly discuss it somewhere else), but did we ever consider a fluent builder API for these lengthy constructors? Instead of sf::RenderWindow window(
sf::VideoMode({800, 600}),
"SFML graphics with OpenGL",
sf::Style::Default,
sf::State::Windowed,
contextSettings);we'd have auto window = sf::RenderWindow::builder()
.videoMode({800, 600})
.title("SFML graphics with OpenGL")
.state(sf::State::Windowed),
.context(contextSettings)
.build();
// no .style() needed if it's the defaultIt may be a bit unidiomatic for SFML, but it would solve the "anything can be default" problem. Would also allow overloads on a per-parameter basis, instead of providing a whole new constructor. |
c033e61 to
e52cf8f
Compare
|
Rebased on |
e52cf8f to
3175267
Compare
|
I implemented addition constructor overloads that let users specify a state without specifying a style. While I was looking at the code I found some issues with the docs that needed correcting and added some missing tests so the PR is overall in a better state now. I'm not sure if we can add extra |
3134b0e to
de032bd
Compare
8962cd6 to
b68dab2
Compare
| /// | ||
| //////////////////////////////////////////////////////////// | ||
| virtual void create(VideoMode mode, const String& title, std::uint32_t style, const ContextSettings& settings); | ||
| virtual void create(VideoMode mode, const String& title, std::uint32_t style, State state, const ContextSettings& settings); |
There was a problem hiding this comment.
Since we're screwing with the API anyway, I'd pull settings in front of style, so both style and state` can have defaults.
b68dab2 to
2bc2fe7
Compare
|
Periodic rebase on |
2bc2fe7 to
5827326
Compare
|
Added missing constructor overload to |
bb1d74b to
3d6e0c8
Compare
3d6e0c8 to
9516a5e
Compare
Description
This is the first step towards implementing https://github.com/SFML/SFML/wiki/SD%3A-States-and-Styles
It converts
Fullscreenfrom aStyleto aState. While I was touching this code I fixed an inconsistency wheresf::Styles were sometimes passed as astd::uint32_tand sometimes anunsigned long.