Values
Resize
Matches scene size to window size. width
and height
of Scene will match window size. Default scaling mode.
Stretch(width:Int, height:Int)
Sets constant Scene size and stretches it to cover entire window. This behavior is same as old setFixedSize
method.
Parameters:
width | The width of the internal Scene viewport. |
---|---|
height | The height of the internal Scene viewport. |
LetterBox(width:Int, height:Int, integerScale:Bool, horizontalAlign:ScaleModeAlign, verticalAlign:ScaleModeAlign)
Sets constant Scene size and upscales it with preserving the aspect-ratio to fit the window.
With 800x600
window, LetterBox(320, 260)
will result in center-aligned Scene of size 320x260
upscaled to fit into the window.
With same window but setting of LetterBox(320, 260, true, Left, Top)
would result in the same Scene internal size,
upscaled to 640x480
resolution and anchored to the top-left corner of the window.
Note that while it's called LetterBox, there is no viewport rendering clipping apart from the out-of-bounds culling in RenderContext.drawTile
/ Object.emitTile
.
Parameters:
width | The width of the internal Scene viewport. |
---|---|
height | The height of the internal Scene viewport. |
integerScale | When enabled, upscaling is performed only with integer increments (1x, 2x, 3x, etc) and can be used to achieve pixel-perfect scaling.
While enabled, the Scene won't be downscaled when internal viewport is larger than the window size and will remain at 1x zoom. Default: |
horizontalAlign | The horizontal viewport anchoring rule. Accepted values are |
verticalAlign | The vertical viewport anchoring rule. Accepted values are |
Fixed(width:Int, height:Int, zoom:Float, horizontalAlign:ScaleModeAlign, verticalAlign:ScaleModeAlign)
Sets constant Scene size, scale and alignment. Does not perform any adaptation to the window size apart from alignment.
With 800x600
window, Fixed(200, 150, 2, Left, Center)
will result in the Scene size of 200x150
, and visually upscaled to 400x300
, and aligned to a middle-left of the window.
Parameters:
width | The width of the internal Scene viewport. |
---|---|
height | The height of the internal Scene viewport. |
zoom | The scaling multiplier of internal viewport when rendering onto the screen. |
horizontalAlign | The horizontal viewport anchoring rule. Accepted values are |
verticalAlign | The vertical viewport anchoring rule. Accepted values are |
Zoom(level:Float)
Upscales/downscales the Scene internal viewport according to level
and matches Scene size to ceil(window size / level)
.
With 800x600
window, Zoom(2)
will result in the 400x300
Scene size upscaled to fill the entire window.
AutoZoom(minWidth:Int, minHeight:Int, integerScaling:Bool)
Ensures that the Scene size will be of the minimum specified size.
Automatically calculates zoom level based on provided size according to min(window width / min width, window height / min height)
, then applies same scaling as Zoom(level)
.
The behavior is similar to LetterBox
, however instead of constant internal viewport size, Scene size will change to cover the entire window.
minWidth
or minHeight
can be set to 0
in order to force scaling adjustment account only for either horizontal of vertical window size.
If both are 0
, results are undefined.
With 800x600
window, AutoZoom(320, 260, false)
will result in the Scene size of 347x260
. AutoZoom(320, 260, true)
will result in the size of 400x300
.
Parameters:
minWidth | The minimum width of the internal Scene viewport. |
---|---|
minHeight | The minimum height of the internal Scene viewport. |
integerScale | When enabled, upscaling is performed only with integer increments (1x, 2x, 3x, etc) and can be used to achieve pixel-perfect scaling.
While enabled, the Scene won't be downscaled when internal viewport is larger than the window size and will remain at 1x zoom. Default: |