RederTexture는 기본적으로 해상도 이상의 사이즈를 사용 할 수 업습니다.


이유는 Camera의 해상도를 넘어가는 부분은 렌더링에서 표시하지 않기 때문인데 이것을 바꿔주면 해결 할 수 있습니다.



    Size originDesignResolution = Director::getInstance()->getOpenGLView()->getDesignResolutionSize();
    Director::getInstance()->getOpenGLView()->setDesignResolutionSize(textureWidth, textureHeight, ResolutionPolicy);
    
    renderTexture->begin();
    
    node->visit();
    
    renderTexture->end();
    
    Director::getInstance()->getOpenGLView()->setDesignResolutionSize(originDesignResolution.width, originDesignResolution.height, ResolutionPolicy);



Posted by 후미카
:

libpng error: CgBI: unhandled critical chunk


위와 같은 에러가 나올 경우 xCode 상의 옵션을 바꿔주면 됩니다.


Remove Text Metadata From PNG Files 옵션을 No 로 변경 해 주면 해결 됩니다.



Posted by 후미카
:

Android NDK: ERROR: [프로젝트 경로]\proj.android-studio\../cocos2d/external/freetype2/prebuilt/android/Android.mk:cocos_freetype2_static: LOCAL_SRC_FILES points to a missing file

Android NDK: Check that [프로젝트 경로]/proj.android-studio/../cocos2d/external/freetype2/prebuilt/android/arm64-v8a/libfreetype.a exists  or that its path is correct



안드로이드 스튜디오로 작업 중 NDK빌드 시 위와 같은 에러가 나타나는 경우가 있다.


이유는 64비트로 prebuilt 된 freetype2가 존재하지 않기 때문이다.


Application.mk 파일 최 상단에 APP_ABI := armeabi 를 추가해주면 armeabi 만 적용 되며 빌드가 된다.


Posted by 후미카
:

CCSpriteBatchNode 를 사용하는데 addChild 되어있는 이미지가 전부 나오지 않는 경우가 있다.

이때는 capacity 를 의심 해 볼 필요가 있는데 로그를 보면 CCSpriteBatchNode 의 capacity를 자동으로 늘려주는 로그가 있다.

이 로그에서 capacity 값이 내가 addChild 한 값보다 작은경우 addChild 한 갯수만큼 처음 생성할때 capatcity 값을 지정해주면 문제 없이 표현이 된다.



    CCSpriteBatchNode* spriteBatch = CCSpriteBatchNode::create("spriteName.png",66);
Posted by 후미카
:
1. CocosDenshion이 재생중인 effects / bgm 만을 일시정지 하도록 수정한다.
2. AppDelegate.cpp 에서 pause / resume 을 하지 않는다. OS 에서 일시정지 하도록 놔두면 된다.
3. (선택사항) AppController.mm 에서 pauseAllEffects 와 resumeAllEffects 를 ApplicationWillResignActive 와 applicationDidBecomeActive 에 넣어 준다.

앞에 + 표시 되어있는 부분이 추가된 부분이다.

/**** CDAudioManager.m ****/
 -(void) pauseBackgroundMusic
  {
 +    if (![self.backgroundMusic isPlaying]) {
 +        return;
 +    }
 +	
      [self.backgroundMusic pause];
  }    


/**** CocosDenshion.m ****/
(void) pauseSound:(ALuint) sourceId {
    if (!functioning_) {
        return;
    }
 +
 +  // only pause a sound id that is playing
 +  ALint state;
 +  alGetSourcei(sourceId, AL_SOURCE_STATE, &state);
 +  if (state != AL_PLAYING)
 +  {
 +    return;
 +  }
 +
    alSourcePause(sourceId);
    alGetError();//Clear error in case we pause any sounds that couldn't be paused
  }


원본 URL
http://discuss.cocos2d-x.org/t/sound-fx-not-playing-after-a-while/623/25

Posted by 후미카
:

error C2360: 'value' 초기화가 'case' 레이블에 의해 생략되었습니다.


case 문 내에서 선언된 로컬변수 때문에 발생하는 오류이다.

할당된 영역이 실행 로직에 따라 가변적이므로 컴파일 시 스택 영역의 크기를 알 수 없기 떄문에 발생하는 오류.


해결방법 :


case 문 내에서 선언 및 초기화를 할 때애는 {} 를 사용하면된다.




switch(type)
{
case A:
	{
		int i = 0;
	}
	break;
}


Posted by 후미카
:

카테고리

전체보기 (102)
Development (102)

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

달력

«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

글 보관함