달력

5

« 2024/5 »

  • 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

1. cocos 3.2 에서 3.3rc 프로젝트 버전 변경하기

 - cocos 3.3rc 다운로드 (http://www.cocos2d-x.org/filedown/cocos2d-x-3.3rc2.zip)

 1) 3.3rc에서 프로젝트를 새로 생성한다.

 2) Classes 와 Resource 폴더를 복사한다.

 3) Classes 는 덮어씌우면 에러를 뿜어내므로, AppDelegate.cpp와 AppDelegate.h는 내용을 복붙한다.

     * 주의점!! AppDelegate 파일들의 추가된 내용이 있으니, 빠지면 에러를 뿜어낸다.

 4) 컴파일하여 확인하면 끝

- AppDelegate.h

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#ifndef  _APP_DELEGATE_H_
#define  _APP_DELEGATE_H_
 
#include "cocos2d.h"
class  AppDelegate : private cocos2d::Application
{
public:
    AppDelegate();
    virtual ~AppDelegate();
    virtual void initGLContextAttrs();        //3.3 에서 추가된 매소드
    virtual bool applicationDidFinishLaunching();
    virtual void applicationDidEnterBackground();
    virtual void applicationWillEnterForeground();
};
 
#endif // _APP_DELEGATE_H


- AppDelegate.cpp

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
32
33
34
35
36
37
38
39
40
41
42
#include "AppDelegate.h"
#include "MenuScene.h"
#include "GameScene.h"
 
USING_NS_CC;
 
AppDelegate::AppDelegate() 
{
}
 
AppDelegate::~AppDelegate()
{
}
 
void AppDelegate::initGLContextAttrs()        //3.3 추가된 부분
{
    GLContextAttrs glContextAttrs = { 8, 8, 8, 8, 24, 8 };
    GLView::setGLContextAttrs(glContextAttrs);
}
 
 
bool AppDelegate::applicationDidFinishLaunching() {
    auto director = Director::getInstance();
    auto glview = director->getOpenGLView();
    if (!glview) {
        glview = GLViewImpl::createWithRect("My Game", Rect(0, 0, 320, 480));    //3.3 변경된 부분
        director->setOpenGLView(glview);
    }
    director->setDisplayStats(false);
    director->setAnimationInterval(1.0 / 60);
    auto scene = GameScene::createScene();
    director->runWithScene(scene);
    return true;
}
 
void AppDelegate::applicationDidEnterBackground() {
    Director::getInstance()->stopAnimation();
}
 
void AppDelegate::applicationWillEnterForeground() {
    Director::getInstance()->startAnimation();
}


2. 포팅 확인하기

 1) Android.mk 파일 복붙 필요 (관련 포스팅 http://genieker.tistory.com/61)

 2) cocos 3.2버전은 NDK r9d버전을 사용하지만, 3.3버전은 NDK r10c 이상의 버전이 필요하다. 

    (http://developer.android.com/tools/sdk/ndk/index.html)

 3) 적당한 곳에 압축해제

 4) 환경변수 변경

- 윈도우키 + pausebreak키 = 시스템->고급시스템설정-> 환경변수-> 사용자변수 -> NDK_ROOT를 아래 그림과 같이 수정

 5) cmd에서 cocos2d-x-3.3rc2 폴더로 이동하여 python setup.py 로 제대로 고쳐졌는지 확인

 6) 컴파일 실행하여 확인


3. 이클립스 디버깅

 1) 3.3에서는 해당 프로젝트만 import하고, 폰이라면 스마트폰 연결하고 실행하면된다. (관련 포스팅 http://genieker.tistory.com/61)



:
Posted by 웽웽