Allow setting window icon with sf::Image#2417
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #2417 +/- ##
==========================================
- Coverage 23.20% 23.18% -0.02%
==========================================
Files 212 212
Lines 18059 18063 +4
Branches 4411 4412 +1
==========================================
- Hits 4190 4188 -2
+ Misses 13415 13149 -266
- Partials 454 726 +272
Continue to review full report at Codecov.
|
ChrisThrasher
left a comment
There was a problem hiding this comment.
You can drop the sf:: namespace in a few places
5343438 to
e9d8448
Compare
|
Is there a particular use case that motivated you to add this? |
|
It's a somewhat common point of confusion, both on Discord & the forums. The advice is always to load it as an image, and pass in the size and pointer (as the PR does). There seems to be no particular reason for it not to be included in the first place. I would assume the majority of users would be setting the icon using a loaded |
e9d8448 to
2529c22
Compare
|
I'm open to this idea. I'm generally a fan of these little helpers that add convenience and make it easier to do functional programming where function return values can be directly passed to other functions. This change is in the same vein as the PRs that replaced |
2529c22 to
cc2a8ab
Compare
|
Love this as a convenience feature for users, I think basically all of my projects with SFML would have used this. It may be a small change, but it's a QoL one for sure. |

Description
Currently, setting window icon is only allowed using a size & pixel pointer.
This overload wraps that, allowing users to set the window icon using an
sf::Imagedirectly.sf::Imagehas the same 32bit RGBA pixel format as required bysetIcon.This is only implemented for
sf::RenderWindow, assf::Imageis part of the graphics module.Tasks