Console 'viewCache' show my large spritesheet in cache 4 times

21 views
Skip to first unread message

Shaun Michael K. Stone

unread,
Sep 30, 2015, 3:48:54 PM9/30/15
to haxef...@googlegroups.com
In my main menu state I am creating only one Sparrow Data and then calling loadGraphicFromTexture for each required graphic. Why is it when I run viewCache in the console I can see the spritesheet is stored 4 times? All of them are identical.

spritesheet.png
spritesheet0.png
spritesheet1.png
spritesheet2.png

return new SparrowData(
PathAssets.getAtlasXml(),
PathAssets.getAtlasAsset()
);

I put a breakpoint in the constructor of Sparrow Data to confirm it is being hit only once.

Thanks.

Shaun Michael K. Stone

unread,
Sep 30, 2015, 4:15:12 PM9/30/15
to HaxeFlixel
I see what mistake I made. Had unique set to true on 3 other sprites. Doh!

menuBar.loadGraphicFromTexture(this.textureAtlas, true, MainMenuScreen.MENU_BAR);

Set to false. Did not realize it made a copy of the spritesheet when doing this. No wonder it was lagging. Spritesheet is 16MB.
Reply all
Reply to author
Forward
0 new messages