SFML community forums

Help => General => Topic started by: JeZ-l-Lee on February 06, 2009, 05:27:01 pm

Title: Having trouble setting icon...App.SetIcon(32, 32, Icon);
Post by: JeZ-l-Lee on February 06, 2009, 05:27:01 pm
Having trouble setting icon...App.SetIcon(32, 32, Icon);

Code: [Select]
sf::Image Icon;
if (!Icon.LoadFromFile("data/graphics/Icon.bmp"))
return EXIT_FAILURE;

App.SetIcon(32, 32, Icon);


What I do wrong?
Thanks...
Title: Having trouble setting icon...App.SetIcon(32, 32, Icon);
Post by: Laurent on February 06, 2009, 05:45:47 pm
Icon is not a const sf::Uint8*. Icon.GetPixelsPtr() is ;)
Title: Having trouble setting icon...App.SetIcon(32, 32, Icon);
Post by: JeZ-l-Lee on February 06, 2009, 06:01:48 pm
Got it working, thanks...
Title: Having trouble setting icon...App.SetIcon(32, 32, Icon);
Post by: sterex on April 01, 2011, 12:58:09 am
could you please show how you did it. I am trying really hard to put an icon
to my application, so far no result. I am having the same code as you..

App.SetIcon (32,32,icon);

latter I changed it to App.SetIcon (32,32,icon.GetPixelsPtr());

still not working. what might I have done?
Title: Having trouble setting icon...App.SetIcon(32, 32, Icon);
Post by: JAssange on April 01, 2011, 02:53:09 am
Quote from: "sterex"
could you please show how you did it. I am trying really hard to put an icon
to my application, so far no result. I am having the same code as you..

App.SetIcon (32,32,icon);

latter I changed it to App.SetIcon (32,32,icon.GetPixelsPtr());

still not working. what might I have done?

Did you load the icon properly? The following code is what I use and it works fine:
Code: [Select]
Image icon;
icon.LoadFromFile("image/icon.png");
window.SetIcon(256,256,icon.GetPixelsPtr());

(I'm only using 256x256 to support the max icon size possible, 32x32 should work fine as well.)