1
Python / Re: Help with drawing on RenderTexture
« on: July 12, 2015, 06:51:40 pm »Hello,
I tried both examples and they work fine (you just forgot to load a font in the second one) on my side, as you can see on this image : https://monosnap.com/file/AEn0kRJDZ8itWCbUasdy04DtMt75L3.png.
Have you tried to use another font ? What version of python and pysfml are you using ?
Thanks for the help. I thought I'd read that a default font would be used if one wasn't provided. The example code does work once one is provided. My own code (the first bit) didn't work because I didn't pay attention to the documentation.
Quote from: 'pySfml Docs'
It is important to note that the Sprite instance doesn’t copy the texture that it uses, it only keeps a reference to it. Thus, an Texture must not be destroyed while it is used by an Sprite.
My code was in the __init__ method of an object (which I failed to mention), so it was destroyed as soon as the method finished. When draw was called on the sprite, the texture it had a reference to no longer existed. Using something like self.tex instead works.