forceOrientation(forceLandscape, forcePortrait)
Force the game to run in only one orientation.
This enables generation of incorrect orientation signals and affects resizing but does not otherwise rotate or lock the orientation.
Orientation checks are performed via the Screen Orientation API, if available in browser. This means it will check your monitor
orientation on desktop, or your device orientation on mobile, rather than comparing actual game dimensions. If you need to check the
viewport dimensions instead and bypass the Screen Orientation API then set: ScaleManager.compatibility.orientationFallback = 'viewport'
Parameters
Name | Type | Argument | Default | Description |
---|---|---|---|---|
forceLandscape | boolean | true if the game should run in landscape mode only. | ||
forcePortrait | boolean | <optional> | false | true if the game should run in portrait mode only. |
- Source code: core/ScaleManager.js (Line 1163)
Please login to continue.