[英]SFML Sprite not displaying for unknown reasons
我不知道为什么,但是我的精灵没有显示。 当我运行代码时,我没有收到任何错误,并且执行了提示操作,并且似乎调用了在sprite上调用setTextureRect的函数。
这是对该函数的调用,在这种情况下,此指针指向Player对象的实例
anim.playFrame(this, sf::IntRect(32, 0, 32, 32));
这就是函数本身,Frame只是sf :: IntRect的typedef
void Animation::playFrame(IAnimatable* entity, Frame frame) {
entity->sprite.setTextureRect(frame);
std::cout << "new texture set" << std::endl;
}
在游戏循环中,我打电话给
Window.draw(player.sprite);
Window.display();
我认为您有白方块问题。 http://www.sfml-dev.org/tutorials/2.3/graphics-sprite.php是您可以找到解决方案的地方(您可能没有找到)。 尽管我仍然遇到问题,但这也发生在我身上。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.