Audio.h
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #ifndef _AUdio_H_ #define _AUdio_H_ class Audio{ public : static Audio* getInstance(); voID playBGM(); playReadyGo(); playPop(); prepare(); playCombo( int size); private : Audio* m_instance; }; #endif |
Audio.cpp
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
#include "SimpleAudioEngine.h"
Audio* Audio::m_instance =
nullptr
;
Audio* Audio::getInstance(){
if
(m_instance ==
){
m_instance =
new
Audio();
}
return
m_instance;
}
Audio::playBGM(){
CocosDenshion::SimpleAudioEngine::getInstance()->playBackgroundMusic(
"Music/music.ogg"
,
true
);
}
Audio::playReadyGo(){
CocosDenshion::SimpleAudioEngine::getInstance()->playEffect(
"Music/readygo.ogg"
false
);
}
Audio::playPop(){
"Music/pop.ogg"
);
}
Audio::playCombo(
@H_334_301@size){ (size < 5)
;
(size >= 10){
"Music/combo_3.ogg"
);
}
else
(size >= 7){
"Music/combo_2.ogg"
);
else
{
"Music/combo_1.ogg"
);
}
}
Audio::prepare(){
CocosDenshion::SimpleAudioEngine::getInstance()->preloadBackgroundMusic(
);
CocosDenshion::SimpleAudioEngine::getInstance()->preloadEffect(
);
);
);
);
);
}
以上是内存溢出为你收集整理的cocos2dx 编写消灭星星音效加载全部内容,希望文章能够帮你解决cocos2dx 编写消灭星星音效加载所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)