예제 #1
0
void TestSearchPath::onExit()
{
    FileUtils *sharedFileUtils = FileUtils::getInstance();

    // reset search path
    sharedFileUtils->setSearchPaths(_defaultSearchPathArray);
    sharedFileUtils->setSearchResolutionsOrder(_defaultResolutionsOrderArray);
    FileUtilsDemo::onExit();
}
예제 #2
0
파일: AppDelegate.cpp 프로젝트: mxpang/lab
bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    auto director = Director::getInstance();
    auto glview = director->getOpenGLView();
    if(!glview) {
        glview = GLView::create("My Game");
        director->setOpenGLView(glview);
    }

    glview->setDesignResolutionSize(768, 1024, ResolutionPolicy::EXACT_FIT);

    FileUtils* futils = FileUtils::getInstance();

    auto screensize = glview->getFrameSize();
    if(screensize.width > 768) {
        vector<string> dirs(1, "hd");
        futils->setSearchResolutionsOrder(dirs);
        director->setContentScaleFactor(2);
    }
    else {
        vector<string> dirs(1, "sd");
        futils->setSearchResolutionsOrder(dirs);
        director->setContentScaleFactor(1);
    }

    SimpleAudioEngine* augine = SimpleAudioEngine::getInstance();

    augine->preloadEffect(futils->fullPathForFilename("hit.wav").c_str());
    augine->preloadEffect(futils->fullPathForFilename("score.wav").c_str());

    // turn on display FPS
    director->setDisplayStats(true);

    // 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 = LogoLayer::createScene();

    // run
    director->runWithScene(scene);

    return true;
}