Beispiel #1
0
void MainScene::preloadMusic()
{
    SimpleAudioEngine *pAudioEngine = SimpleAudioEngine::sharedEngine();
    pAudioEngine->preloadBackgroundMusic(BACK_MUSIC);
    pAudioEngine->preloadEffect(JUMP_MUSIC);
    pAudioEngine->preloadEffect(CROUCH_MUSIC);
}
Beispiel #2
0
void LoadingScene::preloadSounds()
{
    SimpleAudioEngine* audioEngine = SimpleAudioEngine::getInstance();
    audioEngine->stopBackgroundMusic();
    
    audioEngine->preloadEffect(EFFECT_SPACESHIP_CREATION);
    audioEngine->preloadEffect(EFFECT_BOOM_2);
    audioEngine->preloadEffect(EFFECT_BOOM);
    
    audioEngine->playBackgroundMusic(MUSIC_GAME);
    
}
static mrb_value SimpleAudioEngine_preloadEffect(mrb_state *mrb, mrb_value self) {
  mrb_value* args;
  int arg_count;
  mrb_get_args(mrb, "*", &args, &arg_count);
  const char* p0 = mrb_string_value_ptr(mrb, args[0]);
  SimpleAudioEngine* instance = static_cast<SimpleAudioEngine*>(DATA_PTR(self));
  instance->preloadEffect(p0);
  return mrb_nil_value();
}
Beispiel #4
0
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;
}
KDbool SoundManager::init ( KDvoid )
{
	SimpleAudioEngine*		pSE = SimpleAudioEngine::sharedEngine ( );

	// sound loading
	pSE->preloadEffect ( "sound_fx_chip_was_unselected.wav" );
	pSE->preloadEffect ( "sound_fx_regeneration.wav" );
	pSE->preloadEffect ( "sound_fx_selected_chip.wav" );
	pSE->preloadEffect ( "sound_fx_tap.wav" );
	pSE->preloadEffect ( "sound_fx_ready.wav" );
	pSE->preloadEffect ( "sound_fx_new_girl.mp3" );
	pSE->preloadEffect ( "sound_fx_incorrect_matching.mp3" );
	pSE->preloadEffect ( "sound_fx_game_over.mp3" );
	pSE->preloadEffect ( "sound_fx_correct_matching_with_wildcard.mp3" );
	pSE->preloadEffect ( "sound_fx_correct_matching.mp3" );
	
	// music
	pSE->preloadBackgroundMusic ( "sound_music_game.mp3" );
	pSE->preloadBackgroundMusic ( "sound_music_menu.mp3" );

	return KD_TRUE;
}