1
Python / Re: texture rectangle not working
« on: November 26, 2014, 11:03:54 pm »
(Sorry for not being able to provide now a full working example.)
What I do:
Of course this is a basic example and you should do it with proper coding to keep your texture "alive".
Hope it helps.
What I do:
o_texture = sfml.Texture.from_file(s_file) # Full image texture loaded from disk
o_sprite = sfml.Sprite(o_texture) # Creating a sprite from the texture
o_sprite.texture_rectangle = sfml.Rectangle((10, 10), (50, 30)) # "cropping" only the rectangle I want from the full texture
o_sprite = sfml.Sprite(o_texture) # Creating a sprite from the texture
o_sprite.texture_rectangle = sfml.Rectangle((10, 10), (50, 30)) # "cropping" only the rectangle I want from the full texture
Of course this is a basic example and you should do it with proper coding to keep your texture "alive".
Hope it helps.