| 58 | } |
| 59 | |
| 60 | bool AppDelegate::applicationDidFinishLaunching() |
| 61 | { |
| 62 | // Enable logging output colored text style and prefix timestamp |
| 63 | ax::setLogFmtFlag(ax::LogFmtFlag::Full); |
| 64 | |
| 65 | // whether enable global SDF font render support, since axmol-2.0.1 |
| 66 | FontFreeType::setGlobalSDFEnabled(true); |
| 67 | |
| 68 | // As an example, load config file |
| 69 | // FIXME:: This should be loaded before the Director is initialized, |
| 70 | // FIXME:: but at this point, the director is already initialized |
| 71 | Configuration::getInstance()->loadConfigFile("configs/config-example.plist"); |
| 72 | |
| 73 | // initialize director |
| 74 | auto director = Director::getInstance(); |
| 75 | auto renderView = director->getRenderView(); |
| 76 | if (!renderView) |
| 77 | { |
| 78 | std::string title = "Cpp Tests"; |
| 79 | #ifndef NDEBUG |
| 80 | title += " *Debug*", |
| 81 | #endif |
| 82 | #ifdef AX_PLATFORM_PC |
| 83 | renderView = RenderViewImpl::createWithRect(title, Rect(0, 0, g_resourceSize.width, g_resourceSize.height), 1.0F, true); |
| 84 | #else |
| 85 | renderView = RenderViewImpl::createWithRect(title, Rect(0, 0, g_resourceSize.width, g_resourceSize.height)); |
| 86 | #endif |
| 87 | director->setRenderView(renderView); |
| 88 | } |
| 89 | |
| 90 | director->setStatsDisplay(true); |
| 91 | |
| 92 | #ifdef AX_PLATFORM_PC |
| 93 | director->setAnimationInterval(1.0f / glfwGetVideoMode(glfwGetPrimaryMonitor())->refreshRate); |
| 94 | #else |
| 95 | director->setAnimationInterval(1.0f / 60); |
| 96 | #endif |
| 97 | |
| 98 | auto screenSize = renderView->getFrameSize(); |
| 99 | |
| 100 | auto fileUtils = FileUtils::getInstance(); |
| 101 | std::vector<std::string> searchPaths; |
| 102 | |
| 103 | if (screenSize.height > 320) |
| 104 | { |
| 105 | searchPaths.emplace_back("hd"); |
| 106 | searchPaths.emplace_back("ccs-res/hd"); |
| 107 | searchPaths.emplace_back("ccs-res"); |
| 108 | searchPaths.emplace_back("Manifests"); |
| 109 | director->setContentScaleFactor(g_resourceSize.height / g_designSize.height); |
| 110 | |
| 111 | searchPaths.emplace_back("hd/ActionTimeline"); |
| 112 | } |
| 113 | else |
| 114 | { |
| 115 | searchPaths.emplace_back("ccs-res"); |
| 116 | |
| 117 | searchPaths.emplace_back("ActionTimeline"); |
nothing calls this directly
no test coverage detected