#include "AppDelegate.h" #include "HelloWorldScene.h" USING_NS_CC; AppDelegate::AppDelegate() { } AppDelegate::~AppDelegate() { } bool AppDelegate::applicationDidFinishLaunching() { // initialize director auto director = Director::getInstance(); auto glview = director->getOpenGLView(); //이하 if문은 window에서만 적용 if(!glview) { glview = GLView::createWithRect("My Game", Rect(0, 0, 1280, 720)); //윈도우 상에 보이는 해상도를 수치만큼 줄여서 보여줌. 실제 앱에는 적용되지않음. glview->setFrameZoomFactor(0.5f); director->setOpenGLView(glview); } glview->setDesignResolutionSize(1280, 720, ResolutionPolicy::EXACT_FIT); // turn on display FPS director->setDisplayStats(false); // set FPS. the default value is 1.0/60 if you don't call this director->setAnimationInterval(1.0 / 60); // create a scene. it's an autorelease object auto scene = HelloWorld::createScene(); // run director->runWithScene(scene); 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() { Director::getInstance()->stopAnimation(); // if you use SimpleAudioEngine, it must be pause // SimpleAudioEngine::getInstance()->pauseBackgroundMusic(); } // this function will be called when the app is active again void AppDelegate::applicationWillEnterForeground() { Director::getInstance()->startAnimation(); // if you use SimpleAudioEngine, it must resume here // SimpleAudioEngine::getInstance()->resumeBackgroundMusic(); } |