I'm currently developing a game with SDL2 in C++ and I want to set my game's icon for the task bar and for the Alt-Tab switcher. I am trying to achieve this by using SDL_SetWindowIcon():
SDL_Surface* icon = IMG_Load("icon.png");
SDL_SetWindowIcon(sdlWindow, icon);
Even if my window is correctly initialized and the surface is loaded, the icon does not appear in the task bar or in the Alt-Tab switcher. I am on Ubuntu 16.04 LTS.
Does anyone know what I'm doing wrong?
I'm not going to claim that I understand how this function works, but I can share with you how I got it to work. Even though I could use a 600x600 (pixels) image in the desktop.my_app file, and using that launcher would work fine, SDL2 would NOT load a 600x600 image. I tried 128x128 too, and that didn't work.
Changing the image size to 64x64 miraculously fixed it. Storage issue? I don't know why SDL2 can handle huge SDL_Surface s in other parts of the app but not the window icon....
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With