How does SDL_SetWindowIcon work?

Does someone have a more in depth explanation of how SDL_SetWindowIcon works? The documentation on the wiki seems unclear to me. Does someone have an example of what can go wrong, how to use it right, and how the function finds images of different resolutions?

It’s pretty self explanatory.

You have a surface representing the window icon. You can optionally attach additional surfaces to it with SDL_AddSurfaceAlternateImage() that are higher resolution for high DPI displays.

Then you pass this surface to SDL_SetWindowIcon().

1 Like

Far from it - because it doesn’t cross-reference SDL_AddSurfaceAlternateImage(). I had never heard of that function (presumably it’s new in SDL3), and without that knowledge the description is very unclear. There should, at the very least, be a See Also section referencing that function.

5 Likes

tyty! I think this resolves some of my confusion, but it would still be nice to have an example of improper use i think.