Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2014
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.48 KB | None | 0 0
  1. #include "AppDelegate.h"
  2. #include "Menu.h"
  3.  
  4. USING_NS_CC;
  5.  
  6. AppDelegate::AppDelegate() {
  7.  
  8. }
  9.  
  10. AppDelegate::~AppDelegate()
  11. {
  12. }
  13.  
  14. bool AppDelegate::applicationDidFinishLaunching() {
  15.    
  16.         auto director = Director::getInstance();
  17.         auto glview = director->getOpenGLView();
  18.        
  19.     if(!glview) {
  20.             glview = GLView::create("Test");
  21.             director->setOpenGLView(glview);
  22.     }
  23.  
  24.     Size frameSize = Size(540, 960);
  25.     cocos2d::Size designResolutionSize = Size(1080, 1920);
  26.    
  27.     glview->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, ResolutionPolicy::FIXED_WIDTH);
  28.     glview->setFrameSize(frameSize.width, frameSize.height);
  29.  
  30.     director->setDisplayStats(true);
  31.  
  32.     director->setAnimationInterval(1.0 / 60);
  33.  
  34.     ScenaMenu *scenaMenu = ScenaMenu::createWithPhysics();
  35.     director->runWithScene(scenaMenu);
  36.  
  37.         return true;
  38. }
  39.  
  40. // This function will be called when the app is inactive. When comes a phone call,it's be invoked too
  41. void AppDelegate::applicationDidEnterBackground() {
  42.         Director::getInstance()->stopAnimation();
  43.  
  44.         // if you use SimpleAudioEngine, it must be pause
  45.         // SimpleAudioEngine::getInstance()->pauseBackgroundMusic();
  46. }
  47.  
  48. // this function will be called when the app is active again
  49. void AppDelegate::applicationWillEnterForeground() {
  50.         Director::getInstance()->startAnimation();
  51.  
  52.         // if you use SimpleAudioEngine, it must resume here
  53.         // SimpleAudioEngine::getInstance()->resumeBackgroundMusic();
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement