SFML community forums
Help => Graphics => Topic started by: HailBee on September 16, 2013, 12:26:16 pm
-
Here's the code I've tried:
level_Fill.setRepeated(true);
level_Fill.setSmooth(true);
level_Fill.loadFromFile("data/GeoWarsSprites.png");
background.setTexture(&level_Fill);
background.setTextureRect(sf::IntRect(205, 13, 35, 35));
background.setSize(sf::Vector2f(-1100,1100));
background.setPosition(sf::Vector2f(1100,-200));
Im *guessing* the problem is with setSize, what is the proper way to create a square set to a size much bigger than the texture and have the texture repeated? I have followed tutorials no no avail :(
edit: background is defined as a RectangleShape & level_fill as a texture.
-
The shape size must be positive, and the texture rect must be bigger than the texture itself if you want it to repeat.
Note that you won't be able to repeat a subrect of the texture, it must be the whole texture.
-
Ahh shame about not being able to repeat a subRect but ill give it it's own image file which should solve the issue unless my negative placement gets me into trouble.
Thanks for pointing me in the right direction anyhow.