Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [pySFML2-cython] Issue repeating textures  (Read 5445 times)

0 Members and 2 Guests are viewing this topic.

Johnny

  • Newbie
  • *
  • Posts: 2
    • View Profile
[pySFML2-cython] Issue repeating textures
« 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)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: [pySFML2-cython] Issue repeating textures
« Reply #1 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.
Laurent Gomila - SFML developer

Johnny

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: [pySFML2-cython] Issue repeating textures
« Reply #2 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.

 

anything