1 Star 0 Fork 1

自定义/ThreeKing

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
AppDelegate.cpp 2.29 KB
一键复制 编辑 原始数据 按行查看 历史
自定义 提交于 2015-05-15 15:05 . 测试
#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();
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/hlhth/ThreeKing.git
[email protected]:hlhth/ThreeKing.git
hlhth
ThreeKing
ThreeKing
master

搜索帮助