在本例中,纹理不重复。我还能错过什么呢?
链接:https://i.stack.imgur.com/lsEub.png
void Game_Draw()
{
window.Clear(Color.Black);
window.DispatchEvents();
RectangleShape r = new RectangleShape()
{
Position = new Vector2f(20, 20),
Size = new Vector2f(100, 20)
};
Texture t = new Texture("Textures/T_Angle.png")
{
Repeated = true
};
r.Texture = t;
Console.WriteLine(r.Texture.Size);
window.Draw(r);
window.Display();
}
需要为RectangleShape设置textur竖立。对于这个例子:
r.TextureRect = new IntRect(0, 0, 100, 20);
对于你的纹理,尝试这样做,如果需要的话,逐行调试。
Texture texture;
texture.loadFromFile("Textures\T_Angle.png");
texture.setRepeated(true);