1
\$\begingroup\$

I've been playing around with SDL2 and have made a very nifty little program! Now, I'm trying to set my window icon - for the SDL Window. I have the following code in the main function of my program, right after SDL initialization stuff.

            SDL_Surface* icon = IMG_Load("assets/system/interface/icon.png");
        SDL_SetWindowIcon(window, icon);

However, the topbar icon and the toolbar icon remain the same, default application icon! What could I be doing wrong???

Thanks!

\$\endgroup\$
  • \$\begingroup\$ Does SDL_GetError return anything? Is icon properly loaded (not NULL)? \$\endgroup\$ – Tyyppi_77 Nov 20 '17 at 4:23
  • \$\begingroup\$ @Tyyppi_77 Yes, 'SDL_GetError' does return something. However, I don't think it's related or that it affects the program in any meaningful way. I cold be wrong, though! 'Couldn't open C:\TIMIDITY\/etc/timidity/freepats.cfg' \$\endgroup\$ – Eyesight Technology Nov 20 '17 at 4:46
  • \$\begingroup\$ And what about my second question? \$\endgroup\$ – Tyyppi_77 Nov 20 '17 at 5:19
  • \$\begingroup\$ @Tyyppi_77 I wrote an if statement to check if the surface equaled NULL. According to that, everything loaded properly. So that's not the problem either. \$\endgroup\$ – Eyesight Technology Nov 20 '17 at 14:23
  • \$\begingroup\$ Image size could be too large maybe? Try another image, sized 128x128 pixels. See also: stackoverflow.com/questions/41228153/… \$\endgroup\$ – Bram Nov 20 '17 at 18:13
1
\$\begingroup\$

So even though my question was never FULLY answered, (I never changed the taskbar icon) I was still able to change the topbar icon. My problem was simply that the image was sized wrong and had too much transparent space around it. When I deleted the transparent space, everything went perfectly.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.