Jump to content

Loader progress for texture atlas?


Recommended Posts

Hi I am using Texture Packer to create texture atlases and loading them in (which Pixi's loader supports): https://github.com/kittykatattack/learningPixi#loadingatlas


It works fine but I am now creating a preloader for my game and noticed that the "progress" only tracks the progress for the json file not the images the json file loads.


So when I do this: 

loader.add(atlas_dir + 'main_menu_0.json').on('progress', loadProgressHandler).load(setup);function loadProgressHandler(loader, resource) {console.log('loading: ' + resource.url);console.log('progress: ' + loader.progress + '%');console.log('loading: ' + resource.name);loadingText.text = 'Loading ' + Math.round(loader.progress) + '%';renderer.render(stage);}

The progress handler shows 100% complete and runs setup as soon as the JSON is done loading but the sprite sheet in main_menu_0.json will still be loading if I emulate a slow connection.


Any idea what to do here?

Link to comment
Share on other sites

Yeah the loader normally will handle cases like this, and not hit 100% until all resources are loaded (including discovered files from atlases) but there is one exception to that rule: if you load *only* one single atlas.


A fix is to redesign the loader to not treat resources as complete until all subresources are completed, I've thought about this problem but haven't had time to reimplement the loading queue. In the meantime, this should feel better as you add more resources.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...