openfl / starling

Known as the "Cross-Platform Game Engine", Starling is a popular Stage3D framework for OpenFL and Haxe
Other
236 stars 68 forks source link

WEB platform in SystemUtil #96

Closed flashup closed 6 years ago

flashup commented 6 years ago

This port of Starling supports HTML5 targets, but SystemUtils hasn't any indicators of WEB platforms (from Capabilities.version). And therefore AssetFactoryHelper from new AssetManager detects browsers as not desktop target and doesn't perform any function calls when browser window just not in focus.

valr2 commented 6 years ago

You are right! We could add platform == "WEB" in the get_isDesktop() too, besides the existing ones and that should fix it.

As far as I can tell, problems would appear only if your HTML5 app doesn't have focus exactly at the moment when AtfTextureFactory or BitmapTextureFactory would want to create the texture, since these are the places where executeWhenContextReady() from AssetFactoryHelper is used, which in turn relies on isDesktop() to decide if it should execute immediately or check if the app is active and wait otherwise.

I could add this fix myself in a future pull request, if nobody does it sooner, but right now I have a couple of other things pending and I plan to do a pull request later with more commits inside it.