| 65 | } |
| 66 | |
| 67 | bool AppDelegate::applicationDidFinishLaunching() |
| 68 | { |
| 69 | // initialize director |
| 70 | auto director = Director::getInstance(); |
| 71 | auto renderView = director->getRenderView(); |
| 72 | if(!renderView) |
| 73 | { |
| 74 | #if (AX_TARGET_PLATFORM == AX_PLATFORM_WIN32) || (AX_TARGET_PLATFORM == AX_PLATFORM_MAC) || (AX_TARGET_PLATFORM == AX_PLATFORM_LINUX) |
| 75 | renderView = RenderViewImpl::createWithRect("Demo", ax::Rect(0, 0, designResolutionSize.width, designResolutionSize.height)); |
| 76 | #else |
| 77 | renderView = RenderViewImpl::create("Demo"); |
| 78 | #endif |
| 79 | director->setRenderView(renderView); |
| 80 | } |
| 81 | |
| 82 | // turn on display FPS |
| 83 | director->setStatsDisplay(true); |
| 84 | |
| 85 | // set FPS. the default value is 1.0/60 if you don't call this |
| 86 | director->setAnimationInterval(1.0f / 60); |
| 87 | |
| 88 | // Set the design resolution |
| 89 | renderView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, ResolutionPolicy::SHOW_ALL); |
| 90 | // auto frameSize = renderView->getFrameSize(); |
| 91 | // // if the frame's height is larger than the height of medium size. |
| 92 | // if (frameSize.height > mediumResolutionSize.height) |
| 93 | // { |
| 94 | // director->setContentScaleFactor(MIN(largeResolutionSize.height/designResolutionSize.height, largeResolutionSize.width/designResolutionSize.width)); |
| 95 | // } |
| 96 | // // if the frame's height is larger than the height of small size. |
| 97 | // else if (frameSize.height > smallResolutionSize.height) |
| 98 | // { |
| 99 | // director->setContentScaleFactor(MIN(mediumResolutionSize.height/designResolutionSize.height, mediumResolutionSize.width/designResolutionSize.width)); |
| 100 | // } |
| 101 | // // if the frame's height is smaller than the height of medium size. |
| 102 | // else |
| 103 | // { |
| 104 | // director->setContentScaleFactor(MIN(smallResolutionSize.height/designResolutionSize.height, smallResolutionSize.width/designResolutionSize.width)); |
| 105 | // } |
| 106 | |
| 107 | register_all_packages(); |
| 108 | |
| 109 | // prepare for Cubism Framework API. |
| 110 | _cubismOption.LogFunction = LAppPal::PrintMessage; |
| 111 | _cubismOption.LoggingLevel = LAppDefine::CubismLoggingLevel; |
| 112 | Csm::CubismFramework::StartUp(&_cubismAllocator, &_cubismOption); |
| 113 | |
| 114 | _recreatedEventlistener = ax::EventListenerCustom::create(EVENT_RENDERER_RECREATED, [this](EventCustom*) |
| 115 | { |
| 116 | LAppLive2DManager::GetInstance()->RecreateRenderer(); |
| 117 | }); |
| 118 | director->getEventDispatcher()->addEventListenerWithFixedPriority(_recreatedEventlistener, -1); |
| 119 | |
| 120 | // create a scene. it's an autorelease object |
| 121 | auto scene = SampleScene::createScene(); |
| 122 | |
| 123 | // run |
| 124 | director->runWithScene(scene); |
nothing calls this directly
no test coverage detected