Starling-Framework icon indicating copy to clipboard operation
Starling-Framework copied to clipboard

AssetManager should expose it's _starling property and should allow the user to pass a custom starling instance

Open BigPhilCombo opened this issue 9 years ago • 4 comments

It would be beneficial if we could specify the starling instance we'd like to use to the Asset Manager. If not value is specified it could default to Starling.current.

It would be also helpful to expose that value via a public property so it could be used in conjunction with Feathers themes

BigPhilCombo avatar May 10 '16 18:05 BigPhilCombo

Actually, you can already do that, at least indirectly:

var myStarling:Starling = /* ... */
var assetManager:AssetManager = new AssetManager();

myStarling.makeCurrent(); // <-- !!
assetManager.loadQueue();

Whatever is the current Starling instance when you call loadQueue will be stored with the AssetManager. Even if Starling.current changes later, the AssetManager will always work with that instance.

Is that what you were looking for?

PrimaryFeather avatar May 11 '16 10:05 PrimaryFeather

(Accidentally closed. Please close yourself if you find the solution acceptable.)

PrimaryFeather avatar May 11 '16 10:05 PrimaryFeather

That's fine to make the starling you want current before instantiating your asset manager. It would be helpful to expose that internal starling reference in the Asset Manager though, because once loading has completed there is no guarantee which starling instance will be the appropriate one. So if the asset manager had it's property exposed, when loading is complete I can just pass the Asset Manager to any classes that need it and they could use the AM's 'starling' property to upload textures to the correct context.

On Wed, May 11, 2016 at 6:09 AM, Daniel Sperl [email protected] wrote:

(Accidentally closed. Please close yourself if you find the solution acceptable.)

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/Gamua/Starling-Framework/issues/862#issuecomment-218417162

Phillip Chertok

BigPhilCombo avatar May 11 '16 15:05 BigPhilCombo

I see, thanks for the additional info! I'll definitely consider adding such a property. One plan for Starling 2.1 would be to rewrite / enhance the AssetManager for more flexibility; that might be a good time to do just that.

Thanks again for the suggestion!

PrimaryFeather avatar May 12 '16 12:05 PrimaryFeather