#include “HelloWorldScene.h”
#include “AppMacros.h”
#include “SimpleAudioEngine.h”
USING_NS_CC;
CCScene* HelloWorld::scene()
{
// ‘scene’ is an autorelease object
CCScene *scene = CCScene::create();
// 'layer' is an autorelease object
HelloWorld *layer = HelloWorld::create();
// add layer as a child to scene
scene->addChild(layer);
// return the scene
return scene;
}
// on “init” you need to initialize your instance
bool HelloWorld::init()
{
//////////////////////////////
// 1. super init first
if ( !CCLayer::init() )
{
return false;
}
//添加音乐
CocosDenshion::SimpleAudioEngine::sharedEngine()->preloadBackgroundMusic(“Sounds/KSLoading1.ogg”);
CocosDenshion::SimpleAudioEngine::sharedEngine()->playBackgroundMusic(“Sounds/KSLoading1.ogg”, true);
return true;
}
void HelloWorld::menuCloseCallback(CCObject* pSender)
{
CCDirector::sharedDirector()->end();
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
exit(0);
#endif
}
我就加了
#include “SimpleAudioEngine.h”
//添加音乐
CocosDenshion::SimpleAudioEngine::sharedEngine()->preloadBackgroundMusic(“Sounds/KSLoading1.ogg”);
CocosDenshion::SimpleAudioEngine::sharedEngine()->playBackgroundMusic(“Sounds/KSLoading1.ogg”, true);
就是没声音发出来 是不是我哪里还漏了什么 求大神指点!