Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "AppDelegate.h"
- #include "Menu.h"
- USING_NS_CC;
- AppDelegate::AppDelegate() {
- }
- AppDelegate::~AppDelegate()
- {
- }
- bool AppDelegate::applicationDidFinishLaunching() {
- auto director = Director::getInstance();
- auto glview = director->getOpenGLView();
- if(!glview) {
- glview = GLView::create("Test");
- director->setOpenGLView(glview);
- }
- Size frameSize = Size(540, 960);
- cocos2d::Size designResolutionSize = Size(1080, 1920);
- glview->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, ResolutionPolicy::FIXED_WIDTH);
- glview->setFrameSize(frameSize.width, frameSize.height);
- director->setDisplayStats(true);
- director->setAnimationInterval(1.0 / 60);
- ScenaMenu *scenaMenu = ScenaMenu::createWithPhysics();
- director->runWithScene(scenaMenu);
- 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();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement