mwatt Posted December 11, 2013 Share Posted December 11, 2013 Hi all, As the Pixi-based (canvas) project I am working on becomes more mature, I find that my usage of sprites is increasing a lot. It is reaching the point where I begin to think I will need to do pre-loading, which was not necessary earlier in the project. The point of this post is to get recommendations on knowing when textures are loaded. I looked in the code and noticed that Pixi is notifying itself when textures are loaded, so it can know when to update. However, unless I missed it, there is no exposed notification. Did I miss it? If not, I need to figure out how best to do this. I don't want to modify Pixi source, although that would work quite nicely. I could do a timer-based poling and look at texture properties to discover this information but that seems ungainly. I should add that I am currently loading image by image, not via sprite sheet - and would prefer to keep it that way since some images may be dynamically replaced by the user. Any suggestions? Quote Link to comment Share on other sites More sharing options...
bubamara Posted December 11, 2013 Share Posted December 11, 2013 PIXI.AssetLoader can be handyfunction preloadImages() { var assets = ["image01.png", "image02.png"]; var loader = new PIXI.AssetLoader(assets); // when all images are loaded call onImagesLoaded function loader.onComplete = onImagesLoaded; loader.load();} Quote Link to comment Share on other sites More sharing options...
mwatt Posted December 11, 2013 Author Share Posted December 11, 2013 That ought to do it. I knew there had to be some way. I guess I was too fixated and trying to do something with PIXI.Texture.loadFromImage. Thank you. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.