我有一个背景图像,但当我的窗口大小为800 x 600时,它只有256 x 256。我不知道如何使图像在整个窗口中重复。我目前是使用以下代码将图像加载进来:
sf::Texture Bkg;
if(!Bkg.loadFromFile("darkPurple.png"))
{
return -1;
}
sf::Sprite Sprite;
Sprite.setTexture(Bkg);
然后用以下方式进行绘制:
window.draw(Bkg);
我尝试使用:
texture.setRepeated(true);
但是那似乎没有起到帮助的作用。
谢谢!
window.clear(sf::Color(128,0,128));
,前提是"window"是一个RenderWindow对象。 - Dovahkiin