ResolutionPolicy 类型
cc.ResolutionPolicy class is the root strategy class of scale strategy, its main task is to maintain the compatibility with Cocos2d-x
索引
属性(properties)
EXACT_FITNumberThe entire application is visible in the specified area without trying to preserve the original aspect ratio....NO_BORDERNumberThe entire application fills the specified area, without distortion but possibly with some cropping,...SHOW_ALLNumberThe entire application is visible in the specified area without distortion while maintaining the original...FIXED_HEIGHTNumberThe application takes the height of the design resolution size and modifies the width of the internal...FIXED_WIDTHNumberThe application takes the width of the design resolution size and modifies the height of the internal...UNKNOWNNumberUnknow policy
方法
constructorpreApply策略应用前的操作apply调用策略方法postApply策略应用之后的操作setContainerStrategy设置容器的适配策略setContentStrategy设置内容的适配策略
Details
属性(properties)
EXACT_FIT
The entire application is visible in the specified area without trying to preserve the original aspect ratio.
Distortion can occur, and the application may appear stretched or compressed.
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCView.js:1495 |
NO_BORDER
The entire application fills the specified area, without distortion but possibly with some cropping,
while maintaining the original aspect ratio of the application.
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCView.js:1504 |
SHOW_ALL
The entire application is visible in the specified area without distortion while maintaining the original
aspect ratio of the application. Borders can appear on two sides of the application.
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCView.js:1513 |
FIXED_HEIGHT
The application takes the height of the design resolution size and modifies the width of the internal
canvas so that it fits the aspect ratio of the device
no distortion will occur however you must make sure your application works on different
aspect ratios
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCView.js:1522 |
FIXED_WIDTH
The application takes the width of the design resolution size and modifies the height of the internal
canvas so that it fits the aspect ratio of the device
no distortion will occur however you must make sure your application works on different
aspect ratios
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCView.js:1533 |
UNKNOWN
Unknow policy
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCView.js:1544 |
方法
constructor
| meta | description |
|---|---|
| 定义于 | cocos2d/core/platform/CCView.js:1410 |
参数列表
containerStgContainerStrategy The container strategycontentStgContentStrategy The content strategy
preApply
策略应用前的操作
| meta | description |
|---|---|
| 定义于 | cocos2d/core/platform/CCView.js:1429 |
参数列表
viewView The target view
apply
调用策略方法
| meta | description |
|---|---|
| 返回 | Object |
| 定义于 | cocos2d/core/platform/CCView.js:1440 |
参数列表
postApply
策略应用之后的操作
| meta | description |
|---|---|
| 定义于 | cocos2d/core/platform/CCView.js:1455 |
参数列表
viewView The target view
setContainerStrategy
设置容器的适配策略
| meta | description |
|---|---|
| 定义于 | cocos2d/core/platform/CCView.js:1466 |
参数列表
containerStgContainerStrategy
setContentStrategy
设置内容的适配策略
| meta | description |
|---|---|
| 定义于 | cocos2d/core/platform/CCView.js:1478 |
参数列表
contentStgContentStrategy