I am working on a game that uses shared context between Starling and Away3D.
The platform is desktop / browser, so I need to handle resize during the game (as opposed to only on setup).
I have a standard handler for stage resize event that works just fine on plain Staling apps:
const viewPort:Rectangle = _starling.viewPort; viewPort.width = stage.stageWidth; // Native stage viewPort.height = stage.stageHeight; this._starling.viewPort = viewPort; _starling.stage.stageWidth = viewPort.width; // Starling stage _starling.stage.stageHeight = viewPort.height;
That allows me to handle layouts and resize background images if needed, by having the screen containers listen to resize and then query the viewport size (when the window or browser are resized)
However, when using shared context, this cases a strange effect of scaling everything on stage, and also clipping the viewable area to the original window size. When I traced the starling contentScaleFactor I saw values change when I scale.
I'd like to keep contentScaleFactor always as 1 by making sure the viewport and starling stage are the same size, but for some reason the above code does not work when using shared context. Looks like the back buffer just stays the same size regardless.
Is that a bug with the way Starling handles shared context?