I do not know why but my sprite is not displaying. When i run the code i get no errors and i did a cout and it appears the function which calls setTextureRect on the sprite is getting called.
this is the call to the function the this pointer in this case refers to an Instance of the Player object
anim.playFrame(this, sf::IntRect(32, 0, 32, 32));
this is the function itself, Frame is just a typedef for sf::IntRect
void Animation::playFrame(IAnimatable* entity, Frame frame) {
entity->sprite.setTextureRect(frame);
std::cout << "new texture set" << std::endl;
}
In the game loop i called
Window.draw(player.sprite);
Window.display();
I think you have the white square problem. http://www.sfml-dev.org/tutorials/2.3/graphics-sprite.php is where you can find a solution(you might not though). This also happened to me, although I still have the problem.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.