I'm planning to have a responsive UI using Feathers UI, but I don't want it to be scaled together with the stage, however I still want to scale non-UI content (like a gameplay world). I want to simulate StageScaleMode.SHOW_ALL
in a container and add that container to a stage where scaleMode = StageScaleMode.NO_SCALE
.
I would use the following code to do so:
var ratio = appOriginalWidth / appOriginalHeight;
var windowRatio = stage.stageWidth / stage.stageHeight;
var scale = stage.stageWidth / appOriginalWidth;
if (windowRatio > ratio) {
scale = stage.stageHeight / appOriginalHeight;
}
// var windowScaledContainer = ...
windowScaledContainer.scaleX = scale;
windowScaledContainer.scaleY = scale;
/*
let [scaledWidth, scaleHeight] = [appOriginalWidth * scale, appOriginalHeight * scale];
*/
// windowScaledContainer.width = appOriginalWidth;
// windowScaledContainer.height = appOriginalHeight;
windowScaledContainer.x = stage.stageWidth / 2 - appOriginalWidth / 2;
windowScaledContainer.y = stage.stageHeight / 2 - appOriginalHeight / 2;
I'm wondering if there is something equivalent anywhere or some other HaxeLib package?