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

Author Topic: SetIcon problem  (Read 3578 times)

0 Members and 3 Guests are viewing this topic.

  • Guest
SetIcon problem
« on: January 20, 2011, 07:14:28 am »
Hello,
I am new to SFML. Here is part of my code:
Code: [Select]
   // Load and apply Icon
    sf::Image icon;
    if (!image.LoadFromFile("opendarkcore.png"))
        return EXIT_FAILURE;
    window.sf::Window::SetIcon(icon.GetWidth(), icon.GetHeight(), icon.GetPixelsPtr());
    // END of setting Icon


This is what I get:

Code: [Select]
Trying to access the pixels of an empty image
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  53 (X_CreatePixmap)
  Value in failed request:  0x0
  Serial number of failed request:  55
  Current serial number in output stream:  61


What do I do wrong? :(

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
SetIcon problem
« Reply #1 on: January 20, 2011, 07:36:49 am »
Your image is empty. Are you sure that it succeeds to load?
Laurent Gomila - SFML developer

  • Guest
SetIcon problem
« Reply #2 on: January 20, 2011, 09:18:25 am »
But shouldn't it report then EXIT_FAILURE?

  • Guest
SetIcon problem
« Reply #3 on: January 20, 2011, 09:26:06 am »
My whole source is located at:

http://gitorious.org/opendarkcore/master

the file with a problem is main.cpp line 31... I think

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
SetIcon problem
« Reply #4 on: January 20, 2011, 09:32:33 am »
Oh, so that was not a typo in your post ;)

sf::Image icon;
if (!image.LoadFromFile("opendarkcore.png"))
    return EXIT_FAILURE;
Laurent Gomila - SFML developer

  • Guest
SetIcon problem
« Reply #5 on: January 20, 2011, 09:46:30 am »
Now it works :) such a stupid mistake I did...

 

anything