代码拉取完成,页面将自动刷新
#include "AppDelegate.h"
#include "GameCommon.h"
#include "CreateCharacterFacade.h"
USING_NS_CC;
AppDelegate::AppDelegate() {
}
AppDelegate::~AppDelegate()
{
}
bool AppDelegate::applicationDidFinishLaunching() {
// initialize director
CCDirector* pDirector = CCDirector::sharedDirector();
CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();
pDirector->setOpenGLView(pEGLView);
// 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);
CCTexture2D::setDefaultAlphaPixelFormat(kCCTexture2DPixelFormat_RGBA4444);
CCSize screenSize = CCEGLView::sharedOpenGLView()->getFrameSize();
if (screenSize.height != 640)
{
float temp = screenSize.width/screenSize.height;
float temp1 = 960.0/640.0;
float temp2 = 1136.0/640.0;
int t1 = abs(int((temp - temp1) * 100));
int t2 = abs(int((temp - temp2) * 100));
CCLOG("test:%f,%f,%f,%d,%d",temp,temp1,temp2,t1,t2);
CCSize designSize;
CCSize resourceSize;
if(t1 < t2){
designSize = CCSizeMake(960, 640);
resourceSize = CCSizeMake(960, 640);
}else{
designSize = CCSizeMake(1136, 640);
resourceSize = CCSizeMake(1136, 640);
}
pDirector->setContentScaleFactor(resourceSize.height/designSize.height);
CCEGLView::sharedOpenGLView()->setDesignResolutionSize(designSize.width, designSize.height, kResolutionExactFit);
}
INSTANCE(CreateCharacterFacade)->openCreateCharacterScene();
return true;
}
// This function will be called when the app is inactive. When comes a phone call,it's be invoked too
void AppDelegate::applicationDidEnterBackground() {
CCDirector::sharedDirector()->stopAnimation();
// if you use SimpleAudioEngine, it must be pause
// SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();
}
// this function will be called when the app is active again
void AppDelegate::applicationWillEnterForeground() {
CCDirector::sharedDirector()->startAnimation();
// if you use SimpleAudioEngine, it must resume here
// SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic();
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。