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\$
13
  • \$\begingroup\$ Does SDL_GetError return anything? Is icon properly loaded (not NULL)? \$\endgroup\$
    – user35344
    Nov 20, 2017 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\$ Nov 20, 2017 at 4:46
  • \$\begingroup\$ And what about my second question? \$\endgroup\$
    – user35344
    Nov 20, 2017 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\$ Nov 20, 2017 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, 2017 at 18:13

1 Answer 1

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\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .