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

Author Topic: displays Sprite white[solved]  (Read 1691 times)

0 Members and 1 Guest are viewing this topic.

fsteff

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
displays Sprite white[solved]
« on: December 01, 2011, 06:17:35 pm »
I have following problem:
If I load and want to display a sprite, it is fully white(no image)
I am using SFML 2.0 (built it last week)

here the code:
Code: [Select]
sf::Texture Hintergrundbild;
    if (!Hintergrundbild.LoadFromFile("data/Hintergrund.bmp"))
MessageBox(0,"WORLD::CreateWorld #2\nKonnte Hintergrund.bmp nicht laden!",0,0);
Hintergrund = new sf::Sprite(Hintergrundbild);

LoadFormFile returns true

Later I draw it...
Code: [Select]
Fenster->Draw(*Hintergrund);

"Fenster" is a sf::RenderWindow

I am able to move it around, but it doesn´t display the texture.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
displays Sprite white[solved]
« Reply #1 on: December 01, 2011, 06:34:56 pm »
Is the Hintergrundbild texture still alive when you draw the sprite?
Laurent Gomila - SFML developer

fsteff

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
displays Sprite white[solved]
« Reply #2 on: December 01, 2011, 06:43:37 pm »
no... has it to be? if yes, there is the problem...

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
displays Sprite white[solved]
« Reply #3 on: December 01, 2011, 06:44:16 pm »
Of course it has to be, the sprite doesn't have its own copy of the texture; it just uses it ;)
Laurent Gomila - SFML developer

fsteff

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
displays Sprite white[solved]
« Reply #4 on: December 01, 2011, 06:47:28 pm »
thx, there was the problem, now it works fine  :D