Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Having trouble setting icon...App.SetIcon(32, 32, Icon);  (Read 11286 times)

0 Members and 1 Guest are viewing this topic.

JeZ-l-Lee

  • Jr. Member
  • **
  • Posts: 80
    • ICQ Messenger - 223180991
    • MSN Messenger - JeZLee@Live.com
    • AOL Instant Messenger - SLNTHERO@aol.com
    • View Profile
    • http://www.SilentHeroProductions.com
    • Email
Having trouble setting icon...App.SetIcon(32, 32, Icon);
« 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...
JeZ+Lee
Silent Hero Productions(R)
Video Game Design Studio

http://www.SilentHeroProductions.com

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Having trouble setting icon...App.SetIcon(32, 32, Icon);
« Reply #1 on: February 06, 2009, 05:45:47 pm »
Icon is not a const sf::Uint8*. Icon.GetPixelsPtr() is ;)
Laurent Gomila - SFML developer

JeZ-l-Lee

  • Jr. Member
  • **
  • Posts: 80
    • ICQ Messenger - 223180991
    • MSN Messenger - JeZLee@Live.com
    • AOL Instant Messenger - SLNTHERO@aol.com
    • View Profile
    • http://www.SilentHeroProductions.com
    • Email
Having trouble setting icon...App.SetIcon(32, 32, Icon);
« Reply #2 on: February 06, 2009, 06:01:48 pm »
Got it working, thanks...
JeZ+Lee
Silent Hero Productions(R)
Video Game Design Studio

http://www.SilentHeroProductions.com

sterex

  • Newbie
  • *
  • Posts: 5
    • Yahoo Instant Messenger - sterexg
    • View Profile
Having trouble setting icon...App.SetIcon(32, 32, Icon);
« Reply #3 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?
programming is pure fun.

JAssange

  • Full Member
  • ***
  • Posts: 104
    • View Profile
Having trouble setting icon...App.SetIcon(32, 32, Icon);
« Reply #4 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.)