cocos2dx 2.x 屏幕适配问题
2016-12-02 14:40
381 查看
在CCEGLViewProtocol.h中提供方法:
virtual void setDesignResolutionSize(float width,
float height, ResolutionPolicy resolutionPolicy);
其中前面两个参数即为当前解决方案的长宽,第三个参数定义如下:
enum ResolutionPolicy
{
// 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.
kResolutionExactFit,
// The entire application fills the specified area, without distortion but possibly with some cropping,
// while maintaining the original aspect ratio of the application.
kResolutionNoBorder,
// 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.
kResolutionShowAll,
// 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
kResolutionFixedHeight,
// The application takes the width of the design resolution size and modifies the height of the internal
// c
4000
anvas 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
kResolutionFixedWidth,
kResolutionUnKnown,
};
google翻译一下:
1. kResolutionExactFit:整个应用程序在指定区域中可见,而不尝试保留原始长宽比,可能发生失真,可能会显示拉伸或者压缩
2. kResolutionNoBorder:整个应用程序填充指定的区域,没有失真,但可能有一些裁剪,保持原始长宽比
3. kResolutionShowAll:显示所有内容,保持长宽比,会显示黑边
4. kResolutionFixedHeight:保持height的数据适配,width会超出屏幕或者黑边
5. kResolutionFixedWidth:保持width的数据适配,height会超出屏幕或者黑边
6. kResolutionUnKnown:此版本不支持此参数。
virtual void setDesignResolutionSize(float width,
float height, ResolutionPolicy resolutionPolicy);
其中前面两个参数即为当前解决方案的长宽,第三个参数定义如下:
enum ResolutionPolicy
{
// 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.
kResolutionExactFit,
// The entire application fills the specified area, without distortion but possibly with some cropping,
// while maintaining the original aspect ratio of the application.
kResolutionNoBorder,
// 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.
kResolutionShowAll,
// 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
kResolutionFixedHeight,
// The application takes the width of the design resolution size and modifies the height of the internal
// c
4000
anvas 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
kResolutionFixedWidth,
kResolutionUnKnown,
};
google翻译一下:
1. kResolutionExactFit:整个应用程序在指定区域中可见,而不尝试保留原始长宽比,可能发生失真,可能会显示拉伸或者压缩
2. kResolutionNoBorder:整个应用程序填充指定的区域,没有失真,但可能有一些裁剪,保持原始长宽比
3. kResolutionShowAll:显示所有内容,保持长宽比,会显示黑边
4. kResolutionFixedHeight:保持height的数据适配,width会超出屏幕或者黑边
5. kResolutionFixedWidth:保持width的数据适配,height会超出屏幕或者黑边
6. kResolutionUnKnown:此版本不支持此参数。
相关文章推荐
- cocos2d-x lua 屏幕适配问题(OpenGL调用),版本号(cocos2dx v3.4)
- Cocos2dx-3.x 学习笔记一:屏幕分辨率及适配问题
- cocos2dx 屏幕适配问题
- Unity3d开发之实现在Unity3d层C#脚本和在Xcode层Objective-c语言的通信以及NGUI的屏幕适配问题
- android 屏幕适配问题
- android屏幕适配问题
- android 屏幕适配问题
- android 屏幕适配问题
- android 屏幕适配问题
- android 屏幕适配问题
- android 屏幕适配问题
- 屏幕的分辨率适配问题
- android 屏幕适配问题
- android 屏幕适配问题
- android 屏幕适配问题
- 关于Android设备下的屏幕适配问题
- android 屏幕适配问题
- android 屏幕适配问题
- Android 屏幕适配问题
- cocos2dx屏幕适配