일단 기억나는 것만....
사실 23분동안 앱에 업데이트를 받아야 하기 때문에... 23분동안 할일이 업서... ㅠㅠ
***** 사운드
사운드가 안 나왔었다. 알고보니 예전에 사운드 문제가 혹시 있을까봐 주석처리 했던 부분을 안 풀어줬다. 주석처리 했던 부분은 사운드 프리로딩하고 초기화 하는 부분이었다.
=_= 멍청이 아냐....
***** 사운드가 되고 나니까
화면을 꺼도 홈버튼을 눌러도 우ㅋ왕ㅋ 노래가 계속나와
이클립스에서 프로젝트명.java 파일 에 아래처럼 써넣는다.
protected void onResume(){
super.onResume();
Cocos2dxHelper.onResume();
}
AppDelegate.cpp 파일에서 아래를 손봐준다.
// This function will be called when the app is inactive. When comes a phone call,it's be invoked too
void AppDelegate::applicationDidEnterBackground()
{
CCDirector::sharedDirector()->pause();
CCScene *pScene = CCDirector::sharedDirector()->getRunningScene();
CCArray *pArray = pScene->getChildren();
CCLOG("pause child count [%d]", pArray->count());
for (int i=0; i<pArray->count(); i++) {
BaseLayer *pLayer = (BaseLayer*)pArray->objectAtIndex(i);
pLayer->pause();
}
#if( CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID )
// if you use SimpleAudioEngine, it must be pause
CocosDenshion::SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();
#endif
}
// this function will be called when the app is active again
void AppDelegate::applicationWillEnterForeground()
{
CCScene *pScene = CCDirector::sharedDirector()->getRunningScene();
CCArray *pArray = pScene->getChildren();
CCLOG("pause child count [%d]", pArray->count());
for (int i=0; i<pArray->count(); i++) {
BaseLayer *pLayer = (BaseLayer*)pArray->objectAtIndex(i);
pLayer->resume();
}
CCDirector::sharedDirector()->resume();
#if( CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID )
// if you use SimpleAudioEngine, it must resume here
CocosDenshion::SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic();
#endif
}
참고한 사이트 ::
http://www.cocos2d-x.org/boards/6/topics/20078
+) 혹은 네이버 검색창에 [cocos2d-x 배경음악] 이라고 치면 cocos2d-x 사용자 모임 카페에 관련 강좌가 올라와있다. 정회원이 아닌 사람(==나)은 검색해서만 볼 수 있음
***** 웹뷰
http://www.cocos2d-x.org/boards/6/topics/24841
맨 처음 글의 github 소스를 받아서 참고하길. android 와 ios 버전이 모두 있다.
아.. 그리고 보통 cpp 파일만 참고하게 되는데 위 예제 소스를 이클립스에서 열어보면 프로젝트명.java 파일도 수정된 것을 확인할 수가 있다.
***** 이클립스는 CCLOG 는 인식하지 못하고 CCLog는 로그캣에 출력해준다. 더럽다;
***** #if 타겟플랫폼==안드로이드 or iOS 같은 구문을 #include 쯤에 걸고자 한다면... 맨 위에서는 cygwin에서 난리를 침. 고로 include 단에서 위와 같은 구문을 쓰고싶다면 해당 cpp 파일의 헤더가 선언된 다음에 해주어야 할 것 같다.
***** if 문을 쓸 때는
한줄짜리여도 꼭 중괄호를 써줍니다ㅇㅇ..