【发布时间】:2016-07-14 12:20:47
【问题描述】:
在我的 appDelegate 类中,我有类似这样的代码,
在使用 cocos studio 时
auto glview = director->getOpenGLView();
if(!glview) {
glview = GLViewImpl::createWithRect("HelloCpp", Rect(0, 0, 960, 640));
director->setOpenGLView(glview);
}
director->getOpenGLView()->setDesignResolutionSize(960, 640, ResolutionPolicy::SHOW_ALL);
和普通的 cocos2dx 项目一样
没有 cocos 工作室
appDelegate 类中的代码是这样的。
auto glview = director->getOpenGLView();
if(!glview) {
glview = GLViewImpl::create("My Game");
director->setOpenGLView(glview);
}
我的疑问是,setDesignResolutionSize 是否必须设置,并且每个设备尺寸是否都应该相同???
【问题讨论】:
-
No 不是必需的,但我认为使用它很好,如果您设置表面的尺寸,如果您检查第一个代码 createWithRect 它将创建 960*640 的分辨率。我认为这样做的目标是因为手机中有许多不同的尺寸,所以如果您的设备没有该宽高比会发生什么?简单地说,在这种情况下,它会显示所有内容,但图像会被拉伸,ResolutionPolicy::NO_BORDER 它会裁剪一些表面。但这只是支持“多分辨率设备”的一种方式
标签: c++ cocos2d-x cocostudio