SDL_WM_SetIcon(3)
π SDL_WM_SetIcon(3) β the SDL API Reference, but make it cute π
okay bestie, so you're in the SDL API Reference and this page is about SDL_WM_SetIcon, and it's literally the glow-up your window deserves. it's giving "my app has a face now" energy. β¨
πΈ NAME πΈ
SDL_WM_SetIcon β sets the icon for the display window. yes that's it. that's the whole job. iconic behavior, honestly. π
π SYNOPSIS π
#include "SDL.h"
void SDL_WM_SetIcon(SDL_Surface *icon, Uint8 *mask);
look at her. two params. no return. no drama. π
π¦ DESCRIPTION π¦
okay so real talk: this function sets the icon for the display window. that's the little picture in your taskbar / title bar / wherever your window manager decided to put it. main character energy for your app. π
heads up though β Win32 icons must be 32x32. no cap. if you roll up with some other size on Win32, that's not the vibe. π
also, this is the important one, so listen closely:
This function must be called before the first call to SDL_SetVideoMode.
like, before. not after. not during. before. it's giving "get there early or don't come at all." π«Ά
so what do you actually pass in? it takes an icon surface, and a mask in MSB format. the mask is that little bitmask situation that tells the world which pixels are see-through. π«₯
and here's the cute part β if mask is NULL, the entire icon surface will be used as the icon. no masking, no filter, just the whole thing, full send. π
β¨ EXAMPLE β¨
SDL_WM_SetIcon(SDL_LoadBMP("icon.bmp"), NULL);
look at that. one line. load a BMP, pass NULL for the mask, entire surface is the icon, done, slay. this is the "low effort, high reward" of the SDL world. π
π SEE ALSO π
you're gonna want these too, they're basically the group chat:
SDL_SetVideoModeβ the one you have to call after this one, remember?? πSDL_WM_SetCaptionβ for the text up top, so your window has a name too π
and that's the whole page, bestie!! this was written by the SDL crew, dated Tue 11 Sep 2001, 23:02, and it lives on as SDL_WM_SetIcon(3) in the manual forever. go forth and give your window a face. ππ¦β¨ no cap.
π¦ where this page comes from
- debian bookworm: libsdl1.2-dev 1.2.15+dfsg2-8 Β· LGPL-2.1-or-later
- nixos 26.05: SDL_sixel 0-unstable-2016-02-06
- nixpkgs unstable: SDL_sixel 0-unstable-2016-02-06
- ubuntu jammy: libsdl1.2-dev 1.2.15+dfsg2-6 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms