Class cc.ResolutionPolicy
- Defined in: CCEGLView.js
- Extends cc.Class
Constructor Attributes | Constructor Name and Description |
---|---|
cc.ResolutionPolicy(containerStg, contentStg)
cc.ResolutionPolicy class is the root strategy class of scale strategy, its main task is to maintain the compatibility with Cocos2d-x |
Method Summary
Class Detail
cc.ResolutionPolicy(containerStg, contentStg)
cc.ResolutionPolicy class is the root strategy class of scale strategy, its main task is to maintain the compatibility with Cocos2d-x
- Parameters:
- {cc.ContainerStrategy} containerStg
- The container strategy
- {cc.ContentStrategy} contentStg
- The content strategy
Field Detail
<constant>
{Number}
EXACT_FIT
<constant>
{Number}
FIXED_HEIGHT
<constant>
{Number}
FIXED_WIDTH
<constant>
{Number}
NO_BORDER
<constant>
{Number}
SHOW_ALL
<constant>
{Number}
UNKNOWN
Method Detail
-
{object} apply(view, designedResolution)Function to apply this resolution policy The return value is {scale: [scaleX, scaleY], viewport: {cc.Rect}}, The target view can then apply these value to itself, it's preferred not to modify directly its private variables
- Parameters:
- {cc.view} view
- The target view
- {cc.Size} designedResolution
- The user defined design resolution
- Returns:
- {object} An object contains the scale X/Y values and the viewport rect
-
ctor(containerStg, contentStg)Constructor of cc.ResolutionPolicy
- Parameters:
- {cc.ContainerStrategy} containerStg
- {cc.ContentStrategy} contentStg
-
postApply(view)Manipulation after appyling the strategy
- Parameters:
- {cc.view} view
- The target view
-
preApply(view)Manipulation before applying the resolution policy
- Parameters:
- {cc.view} view
- The target view
-
setContainerStrategy(containerStg)Setup the container's scale strategy
- Parameters:
- {cc.ContainerStrategy} containerStg
-
setContentStrategy(contentStg)Setup the content's scale strategy
- Parameters:
- {cc.ContentStrategy} contentStg