SFML community forums

Bindings - other languages => Python => Topic started by: Johnny on September 15, 2012, 09:23:01 pm

Title: [pySFML2-cython] Issue repeating textures
Post by: Johnny on September 15, 2012, 09:23:01 pm
I can't figure out how to repeat a texture (without it automatically resizing) over a larger shape.

      texture = sf.Texture.load_from_file("test.png")
      texture.repeated = True
      rectangle.set_texture(texture, reset_rect=False)

The bool values don't appear to do anything. Does anybody know what I'm doing wrong? Thanks.

(A full example: https://gist.github.com/3728984 (https://gist.github.com/3728984))
Title: Re: [pySFML2-cython] Issue repeating textures
Post by: Laurent on September 15, 2012, 09:47:25 pm
The area of the texture which is mapped to the shape is defined by the textureRect property. So, to have the texture repeated N times, the textureRect must be N times bigger than the texture.
Title: Re: [pySFML2-cython] Issue repeating textures
Post by: Johnny on September 15, 2012, 11:36:03 pm
Aha! That makes sense, it works fine now. Thanks a ton for the prompt and helpful response.