마음의 평화..
코코스 초기 프로젝트를 생성하면 다음과 같은 코드가 기본으로 생성되어 있다.
// Set the design resolution glview->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, ResolutionPolicy::SHOW_ALL); Size frameSize = glview->getFrameSize(); // if the frame's height is larger than the height of medium size. if (frameSize.height > resolutionSize3.height) { director->setContentScaleFactor(MIN(designResolutionSize.height / resolutionSize4.height, designResolutionSize.width / resolutionSize4.width)); } // if the frame's height is larger than the height of small size. else if (frameSize.height > resolutionSize2.height) { director->setContentScaleFactor(MIN(designResolutionSize.height/ resolutionSize3.height, designResolutionSize.width/resolutionSize3.width)); } else if (frameSize.height > resolutionSize1.height) { director->setContentScaleFactor(MIN(designResolutionSize.height / resolutionSize2.height, designResolutionSize.width / resolutionSize2.width)); } // if the frame's height is smaller than the height of medium size. else { director->setContentScaleFactor(MIN(designResolutionSize.height / resolutionSize1.height, designResolutionSize.width / resolutionSize1.width)); }
이것 때문에 한참을 뻘짓하다가..(contentScaleFactor에 버그가 있는지, 1보다 큰 값을 넣어줘도 줄어들 때가 있는가 하면 작은 값을 넣어주면 원래 의도보다 너무 커지거나 하는 경우도 있다.)
얻은 해답은 위의 코드를 전부 삭제하는 것이다.
// Set the design resolution glview->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, ResolutionPolicy::SHOW_ALL); Size frameSize = glview->getFrameSize();
다만, 이 부분만 남겨 두면 된다.
setDesignResolutionSize 함수 하나만으로 (그리고 뒤에 넣어주는 ResolutionPolicy 인자만으로)
자동으로 모든 해상도에 맞춰서 자르고 늘리고 끼우고 다 해준다.
왜 아래의 필요없는 코드를 샘플 프로젝트에 포함시켜 두었는지는 의문.
갤럭시S6에서 잘 나오는 기념으로 인증샷
'엔진 > Cocos2d-x' 카테고리의 다른 글
cocos2d-x 안드로이드 빌드시 C++ 14 적용하기 (0) | 2016.05.23 |
---|---|
이해할 수 없는 cocos2d-x의 사운드 기능 (2) | 2016.05.14 |
cocos2d-x Component 기능 사용 (0) | 2016.04.18 |
Cocos2d-x 프로젝트 생성 (0) | 2016.03.24 |
3시간 걸려서 만들었다 ㅠㅠ...
느낌 괜찮은가..
내가 만들어 놓으니 내 눈에는 이쁘다.
이 느낌으로 가도 될런지...
'개발일지 > SiegeMode!' 카테고리의 다른 글
전투시스템도 대충 구현했다. (0) | 2016.04.30 |
---|---|
첫 빌드. 유한상태머신 구현 (0) | 2016.04.15 |
모바일에서는 아무리 생각해도 사이드뷰가 나을 것 같다. (0) | 2016.04.10 |
SiegeMode! 1차 기획 완료 (1) | 2016.04.09 |
Stronghold를 플레이 해보았다. (0) | 2016.04.09 |