Sets whether the engine modify the "viewport" meta in your web page.
It's enabled by default, we strongly suggest you not to disable it.
And even when it's enabled, you can still set your own "viewport" meta, it won't be overridden
Only useful on web
Enable automatic modification to "viewport" meta
Returns the real location in view for a translation based on a related position
The X axis translation
The Y axis translation
The related position object including "left", "top", "width", "height" informations
The out object to save the conversion result
If enabled, the application will try automatically to enter full screen mode on mobile devices
You can pass true as parameter to enable it and disable it by passing false.
Only useful on web
Enable or disable auto full screen on mobile devices
Retina support is enabled by default for Apple device but disabled for other devices,
it takes effect only when you called setDesignResolutionPolicy
Only useful on web
Enable or disable retina display
Returns the canvas size of the view.
On native platforms, it returns the screen size since the view is a fullscreen view.
On web, it returns the size of the canvas element.
Returns the designed size for the view. Default resolution size is the same as 'getFrameSize'.
Returns device pixel ratio for retina display.
Returns the frame size of the view.
On native platforms, it returns the screen size since the view is a fullscreen view.
On web, it returns the size of the canvas's outer DOM element.
Returns the current resolution policy
Returns scale factor of the horizontal direction (X axis).
Returns scale factor of the vertical direction (Y axis).
Returns the view port rectangle.
Returns the visible origin of the view port.
Returns the visible origin of the view port.
Returns the visible area size of the view port.
Returns the visible area size of the view port.
Check whether auto full screen is enabled.
Only useful on web
Auto full screen enabled or not
Check whether retina display is enabled.
Only useful on web
Sets whether resize canvas automatically when browser's size changed.
Useful only on web.
Whether enable automatic resize with browser's resize event
Sets the resolution policy with designed view size in points.
The resolution policy include:
[1] ResolutionExactFit Fill screen by stretch-to-fit: if the design resolution ratio of width to height is different from the screen resolution ratio, your game view will be stretched.
[2] ResolutionNoBorder Full screen without black border: if the design resolution ratio of width to height is different from the screen resolution ratio, two areas of your game view will be cut.
[3] ResolutionShowAll Full screen with black border: if the design resolution ratio of width to height is different from the screen resolution ratio, two black borders will be shown.
[4] ResolutionFixedHeight Scale the content's height to screen's height and proportionally scale its width
[5] ResolutionFixedWidth Scale the content's width to screen's width and proportionally scale its height
[ResolutionPolicy] [Web only feature] Custom resolution policy, constructed by ResolutionPolicy
Design resolution width.
Design resolution height.
The resolution policy desired
On native, it sets the frame size of view.
On web, it sets the size of the canvas's outer DOM element.
Sets the orientation of the game, it can be landscape, portrait or auto.
When set it to landscape or portrait, and screen w/h ratio doesn't fit,
view
will automatically rotate the game canvas using CSS.
Note that this function doesn't have any effect in native,
in native, you need to set the application orientation in native project settings
Possible values: macro.ORIENTATION_LANDSCAPE | macro.ORIENTATION_PORTRAIT | macro.ORIENTATION_AUTO
Sets the container to desired pixel resolution and fit the game content to it. This function is very useful for adaptation in mobile browsers. In some HD android devices, the resolution is very high, but its browser performance may not be very good. In this case, enabling retina display is very costy and not suggested, and if retina is disabled, the image may be blurry. But this API can be helpful to set a desired pixel resolution which is in between. This API will do the following: 1. Set viewport's width to the desired width in pixel 2. Set body width to the exact pixel resolution 3. The resolution policy will be reset with designed view size in points.
Design resolution width.
Design resolution height.
The resolution policy desired
Sets the callback function for view
's resize action,
this callback will be invoked before applying resolution policy,
so you can do any additional modifications within the callback.
Useful only on web.
The callback function
Sets the current resolution policy
Generated using TypeDoc
View represents the game window.
It's main task include:
With {{view}} as its singleton initialized by the engine, you don't need to call any constructor or create functions,
the standard way to use it is by calling: