本文整理汇总了C++中GLView::setFrameSize方法的典型用法代码示例。如果您正苦于以下问题:C++ GLView::setFrameSize方法的具体用法?C++ GLView::setFrameSize怎么用?C++ GLView::setFrameSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLView
的用法示例。
在下文中一共展示了GLView::setFrameSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: applicationDidFinishLaunching
bool AppDelegate::applicationDidFinishLaunching() {
// initialize director
Director* pDirector = gDirector;
GLView* pGLView = pDirector->getOpenGLView();
if( NULL == pGLView )
{
pGLView = GLView::create("game(v1.0.0.0)---test for inner");
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
pGLView->setFrameSize(1334, 750);
#endif
pDirector->setOpenGLView(pGLView);
}
// turn on display FPS
pDirector->setDisplayStats(true);
// set FPS. the default value is 1.0/60 if you don't call this
pDirector->setAnimationInterval(1.0 / 60);
// resolution information
Size size;
size= pDirector->getWinSize();
log("***IDONG: Director getWinSize:w=%f,h=%f",size.width,size.height);
size = pDirector->getWinSizeInPixels();
log("***IDONG: Director getWinSizeInPixels:w=%f,h=%f",size.width,size.height);
size = pDirector->getVisibleSize();
log("***IDONG: Director getVisibleSize:w=%f,h=%f",size.width,size.height);
Point point = pDirector->getVisibleOrigin();
log("***IDONG: Director getVisibleOrigin:x=%f,y=%f",point.x,point.y);
log("***IDONG: Director BS: getContentScaleFactor: scaleFactor=%f",pDirector->getContentScaleFactor());
auto framsize = pGLView->getFrameSize();
auto dwinsize = pDirector->getWinSize();
auto designsize = Size(SCREEN_WIDTH, SCREEN_HEIGHT);
auto widthRate = framsize.width/designsize.width;
auto heightRate = framsize.height/designsize.height;
auto resolutionRate = 1.f;
if(widthRate > heightRate)
{
pGLView->setDesignResolutionSize(designsize.width,
designsize.height*heightRate/widthRate, ResolutionPolicy::NO_BORDER);
resolutionRate = heightRate/widthRate;
}
else
{
pGLView->setDesignResolutionSize(designsize.width*widthRate/heightRate, designsize.height,
ResolutionPolicy::NO_BORDER);
resolutionRate = widthRate/heightRate;
}
//pGLView->setDesignResolutionSize(SCREEN_WIDTH, SCREEN_HEIGHT, ResolutionPolicy::FIXED_HEIGHT);
log("***IDONG:/n");
log("***IDONG: Director AS: getContentScaleFactor: scaleFactor=%f",pDirector->getContentScaleFactor());
size= pDirector->getWinSize();
log("***IDONG: Director getWinSize:w=%f,h=%f",size.width,size.height);
size = pDirector->getWinSizeInPixels();
log("***IDONG: Director getWinSizeInPixels:w=%f,h=%f",size.width,size.height);
size = pDirector->getVisibleSize();
log("***IDONG: Director getVisibleSize:w=%f,h=%f",size.width,size.height);
point = pDirector->getVisibleOrigin();
log("***IDONG: Director getVisibleOrigin:x=%f,y=%f",point.x,point.y);
// ‘ˆº”À—À˜¬∑æ∂
gFileUtils->addSearchPath("assets");
// …Ë÷√◊ ‘¥ƒø¬�?
// ≥ı ºªØ◊ ‘¥ƒø¬�?dumpŒƒº˛…˙≥…ƒø¬�?
string logfile = "";
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
gGameManager->SetResourceRoot("/mnt/sdcard/com.zm.mszb/");
gGameManager->CreateDirectory(gGameManager->GetResourceRoot());
gGameManager->CreateDirectory(gGameManager->GetLogPath());
logfile = gGameManager->GetLogPath()+"/log.txt";
gLog->Open(logfile.c_str());
#endif
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
gGameManager->SetResourceRoot("");
gGameManager->CreateDirectory(gGameManager->GetResourceRoot());
gGameManager->CreateDirectory(gGameManager->GetLogPath());
logfile = gGameManager->GetLogPath()+"/log.txt";
gLog->Open(logfile.c_str());
#endif
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
gGameManager->SetResourceRoot(gFileUtils->getWritablePath());
gGameManager->CreateDirectory(gGameManager->GetResourceRoot());
gGameManager->CreateDirectory(gGameManager->GetLogPath());
logfile = gGameManager->GetLogPath()+"/log.txt";
//.........这里部分代码省略.........