RelativeScaleMode is a scaling mode which stretches and squashes the game to exactly fit the provided window. It acts similar to the FillScaleMode, however there is one major difference. RelativeScaleMode takes two parameters, which represent the width scale and height scale.

For example, RelativeScaleMode(1, 0.5) will cause the game to take up 100% of the window width, but only 50% of the window height, filling in the remaining space with a black margin.

To enable it in your project, use FlxG.scaleMode = new RelativeScaleMode();.


new(WidthScale:Float, HeightScale:Float)


setScale(WidthScale:Float, HeightScale:Float):Void

Inherited Variables

Defined by BaseScaleMode

@:value(CENTER)horizontalAlign:FlxHorizontalAlign = CENTER

read onlyoffset:FlxPoint

read onlyscale:FlxPoint

@:value(CENTER)verticalAlign:FlxVerticalAlign = CENTER

Inherited Methods

Defined by BaseScaleMode

onMeasure(Width:Int, Height:Int):Void