#include <NewAudioEngineTest.h>
◆ CREATE_FUNC()
◆ init()
| bool AudioLoadTest::init |
( |
| ) |
|
|
overridevirtual |
在文件 NewAudioEngineTest.cpp 第 394 行定义.
396 if (AudioEngineTestDemo::init())
398 auto& layerSize = this->getContentSize();
400 auto stateLabel = Label::createWithTTF(
"status:",
"fonts/arial.ttf", 30);
401 stateLabel->setPosition(layerSize.width / 2, layerSize.height * 0.7f);
402 addChild(stateLabel);
404 auto preloadItem = TextButton::create(
"preload", [&, stateLabel](TextButton* button){
405 stateLabel->setString(
"status:loading...");
407 AudioEngine::preload(
"audio/SoundEffectsFX009/FX082.mp3", [isDestroyed, stateLabel](
bool isSuccess){
410 CCLOG(
"AudioLoadTest scene was destroyed, no need to set the label text.");
416 stateLabel->setString(
"status:load success");
420 stateLabel->setString(
"status:load fail");
424 preloadItem->setPosition(layerSize.width * 0.35f, layerSize.height * 0.5f);
425 addChild(preloadItem);
427 auto uncacheItem = TextButton::create(
"uncache", [&, stateLabel](TextButton* button){
428 stateLabel->setString(
"status:uncache");
429 AudioEngine::uncache(
"audio/SoundEffectsFX009/FX082.mp3");
431 uncacheItem->setPosition(layerSize.width * 0.65f, layerSize.height * 0.5f);
432 addChild(uncacheItem);
std::shared_ptr< bool > _isDestroyed
引用了 AudioEngineTestDemo::_isDestroyed.
◆ title()
| std::string AudioLoadTest::title |
( |
| ) |
const |
|
overridevirtual |
该类的文档由以下文件生成:
- /Users/yujizhu/Documents/Git/cocos2d-x-4.0/tests/cpp-tests/Classes/NewAudioEngineTest/NewAudioEngineTest.h
- /Users/yujizhu/Documents/Git/cocos2d-x-4.0/tests/cpp-tests/Classes/NewAudioEngineTest/NewAudioEngineTest.cpp