SFML community forums

Bindings - other languages => Python => Topic started by: omariisan on January 23, 2014, 03:16:30 am

Title: Sprite without texture
Post by: omariisan on January 23, 2014, 03:16:30 am
Perhaps I missed this in the documentation, but earlier I was trying to create a Sprite without a texture. I have a GameObject object which has a Sprite object, but I want to set the texture afterwards by pulling it from a texture manager (still not sure how I'm going to implement this). However, it seems I cannot create a Sprite without a texture! Why is this so? The C++ bindings allowed this. Using None creates a giant white square...
Title: Re: Sprite without texture
Post by: math1992 on January 23, 2014, 03:52:28 am
Yes, if you do not set a Texture on a sprite, it's normal that a white square is displayed.
Also, you can set the Texture before even if the texture is not created (Of course you must eventually create it before drawing the Sprite.)
Title: Re: Sprite without texture
Post by: Jesper Juhl on February 03, 2014, 09:28:11 pm
A sprite without a texture makes little sense. It shouldn't be a big deal to (re-)organize your code to ensure the texture is available before the sprite needs it.
Why do you need a non-textured sprite? And why would you want to draw it before it has a texture?