protolib draw2DSprite

19 views
Skip to first unread message

David Reyes

unread,
Mar 20, 2015, 1:08:54 PM3/20/15
to turbulenz-e...@googlegroups.com
hi everyone.
I have some questions about this function.

for my understanding , protolib.daw2DSprite draws the texture if it exist

so I draw a background and a button that also is a .png texture, so when i pass the mouse over the button I draw another .png button  simulating an actual button.
When the screen loads it all looks fine, 
but when I pass the mouse over the button the fist time , it draws a pink rectangle for milliseconds, and after that the button function fine and that pink texture doesnt bother anymore.

I have the same problem with another textures in my game ..
any idea how I can solve this?
 thanks 

Ian Ballantyne

unread,
Apr 9, 2015, 4:57:44 AM4/9/15
to turbulenz-e...@googlegroups.com
This is because Protolib will start drawing the sprite using the default texture even before the texture has been loaded. If you use the TextureManager to load the texture before you start rendering the sprite in the initialisation and then check all textures have been loaded before calling draw2DSprite, that should have the right behaviour.
Reply all
Reply to author
Forward
0 new messages