Texture Atlas

27 views
Skip to first unread message

Uldis Baurovskis

unread,
Dec 7, 2015, 4:59:18 PM12/7/15
to HaxeFlixel
Hi. I have question about texture atlases in HaxeFlixel. I can create them and use them but I would like to have more information on how to store them. 

Can I create one texture atlas and use it in all states or should I recreate it on every state? 

A looked in source of HaxeFlixle and found that all images are cached in background so if I create new texture atlas with the same image as source will it create new instance or use cached on? 

I tried to store atlas globally but when I changed states I got null pointer in atlas asset because BitmapData in Atlas object was destroyed. 

So I would like to know what is the best way to use texture atlases in HaxeFlixel games.

Thanks.

Jeru Sanders

unread,
Dec 7, 2015, 6:09:37 PM12/7/15
to HaxeFlixel
You can go ahead and call "new TexturePackerData()" repeatedly, the images will be pulled from that cache internally.

Uldis Baurovskis

unread,
Dec 8, 2015, 2:08:12 AM12/8/15
to HaxeFlixel
That's good. Thank you for tip :)
Reply all
Reply to author
Forward
0 new messages