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

Author Topic: [SFML 2] explicit Bind?  (Read 2053 times)

0 Members and 1 Guest are viewing this topic.

gsaurus

  • Sr. Member
  • ****
  • Posts: 262
    • View Profile
    • Evolution Engine
[SFML 2] explicit Bind?
« on: February 23, 2010, 12:51:29 am »
I'm finally trying sfml2.
By accident, I got a sprite being drawn in white instead of it's original image.




I reproduced it this way:

Code: [Select]
#include <SFML\Graphics.hpp>

int main(){
    sf::RenderWindow App(sf::VideoMode(200, 200, 32), "press key for white picture!");

    sf::Image img;

    while (App.IsOpened()){
        sf::Event Event;
        while (App.GetEvent(Event)){
            if (Event.Type == sf::Event::Closed) App.Close();            
            if (Event.Type == sf::Event::KeyPressed){
                img.LoadFromFile("paddle_right.png");
            }
        }

        App.Clear();
        App.Draw(sf::Sprite(img));
        App.Display();
    }

    return EXIT_SUCCESS;
}


The image is from the pong example.
The same code works with SFML 1.6.
Calling img.Bind() after loading solves it. Am I supposed to explicitly call Bind?
Pluma - Plug-in Management Framework

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
[SFML 2] explicit Bind?
« Reply #1 on: February 23, 2010, 08:40:19 am »
Thanks, I'll try to fix it today :)
Laurent Gomila - SFML developer

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
[SFML 2] explicit Bind?
« Reply #2 on: February 25, 2010, 08:06:52 pm »
It should work now.
Laurent Gomila - SFML developer

 

anything