2019년 6월 13일 목요일

[GOOD LUCK][COCOS] cocos 버전업시 필요한 작업(android)

1. CCRef.h 변수 추가 

  - 변수와 함수 추가 한다. 

   long long m_lValue;
   int m_nIndex;

   // ui value
   long long get_value();
   void set_value(long long a_lValue);

   // ui index
   int get_index();

   void set_index(int a_nIndex);


2. SDK Manager 추가 다운로드 

   - Google Play services 설치 

3. Cocos2dxActivity.java 수정

  구글 로그인 계정 연동을 위해 수정 작업
  class Cocos2dxActivity extends Activity

 -->  class Cocos2dxActivity extends FragmentActivity


 실제로는 변경 되는 클래스
 Activity --> FragmentActivity


 수정 이유는 new GoogleApiClient.Builder(this) 호출시 에러 발생


  FragmentActivity 사용하기 위해서는 추가 라이브러리 적용
  cocos2d\cocos\platform\android\libcocos2dx\build.gradle  
  compile 'com.android.support:support-v4:26.0.1'


4. build.gradle 머지

   proj.android/app/build.gradle
   proj.android/build.gradle
  
  두개의 파일 머지 머지 진행

5. billing 적용

   결제 시스템을 적용을 위해 
    proj.android/app/src/org/cocos2dx/cpp/util 폴더안의 소스 추가 

    android studio 에서 패키지 추가로 IInAppBillingService.aidl 추가
    자세한건 구글에서 찾아서 적용
   
  

2019년 5월 30일 목요일

[GOOD LUCK][COCOS] 개발 환경 구성 13 - cocos2d-x - 서버 개발 환경 구성 (window) - maria db 설치

1. maria db 다운로드 

   1) https://downloads.mariadb.org/ 다운로드
    현재 버전이 10.3.15 다운로드 진행합니다.

   


2. maria db 설치 


 설치 방법에 대해서는 자세하게 설명하지 않겠습니다.





3. 접속 확인(HeidiSQL)

 1) 설치 중에 자동으로 설치가 됩니다.
    만약에 설치에서 제외 되었으면 다운로드 및 설치 먼저 진행 하십시오
    https://www.heidisql.com/





 2) 설치중에 생성한 root 패스워드를 입력하여 접속 한다. 


  

3) 접속 성공


  

[GOOD LUCK][COCOS] 개발 환경 구성 12 - cocos2d-x - 서버 개발 환경 구성 (window) - 환경 구성

1. 서버 프로젝트 생성

   1) 빈 프로젝트로 생성
   2) 이름 : game_server
   3) 솔루션 이름 : server

  


2. stdafx.h, stdafx.cpp, main.cpp 생성

  1) 속성 --> 추가 에서 main 및 미리컴파일된 헤더(Precomplied Header) 추가

  2) 미리컴파일된 헤더(Precomplied Header) 방법은 이전 게시글에서 참고하여 구성
    https://nondevelop.blogspot.com/2019/05/good-louccocos-7-cocos2d-x-win32_24.html


    

  프로젝트 구성 방식은 개인적인 스타일이라 다르게 하셔도 됩니다.


3. login_server, world_server 프로젝트 추가 

  속성 --> 추가 에서 새 프로젝트 추가 하여 game_server와 같은 방식으로
  기본 구성 하면 됩니다.


2019년 5월 27일 월요일

[GOOD LUCK][COCOS] 개발 환경 구성 11 - cocos2d-x - win32 클라이언트 빌드 환경 구성 (window) - boost library 적용

1. boost 다운로드(https://www.boost.org)

   다운 로드 및 압축 해제

   공유 하다 보니 1.70으로 작업이 진행 되었습니다. 
   1.69 버전 다운 받아 적용 바랍니다. 
   진행 방식에는 차이가 없습니다. 
  




2. bootstrap.bat 실행

   bootstrap.bat 더블 클릭하여 실행 한다. 




3. boost install 진행

 1) 압축 해제한 경로로 이동


  


 2) 명령어로 입력 후 빌드 진행


b2 toolset=msvc-14.1 link=static,shared threading=multi address-model=32 runtime-link=shared variant=debug --without-python --without-mpi --prefix=./release_run_time_shared_32 install


4. 프로젝트로 include 및 lib 경로 추가 

  1) 프로젝트 위치에 복사

    복사한 경로 입니다.  boost\win\debug_run_time_shared_32



  2) include 추가( 포함 디렉터리 추가) 

    프로젝트 우클릭 --> 속성 --> VC++ 디렉터리 --> 포함 디렉터리
    --> 편집 --> 추가 --> 경로 입력 


    ..\boost\win\debug_run_time_shared_32\include\boost-1_70

   




  3) lib 추가( 라이브러리 디렉터리 추가) 

    프로젝트 우클릭 --> 속성 --> VC++ 디렉터리 --> 라이브러리 디렉터리
    --> 편집 --> 추가 --> 경로 입력 


    ..\boost\win\debug_run_time_shared_32\lib





5. 빌드 확인


  



2019년 5월 26일 일요일

[GOOD LUCK][COCOS] 개발 환경 구성 10 - cocos2d-x - xcode 클라이언트 빌드 환경 구성 (ios) - boost library 적용

1. 다운로드(https://github.com/danoli3/ofxiOSBoost)

   빌드된 라이브러리가 있어 바로 사용 가능 합니다.
   1.60 버전이라 현재 진행한 1.69 버전이랑 차이가 있지만 프로젝트 진행에 문제 없어 그대로 사용합니다.



2. 압축 해제

 libs/boost에서 include와 ios를 내 프로젝트로 복사 한다.  


3. xcode에 boost header경로와 lib 경로 설정

 1) boost include  경로 추가 (debug와 release 모두)


Build Settings --> Search Paths --> Header Search Paths --> Debug(Release)


 2) boost lib 경로 추가 (debug와 release 모두)

Build Settings --> Search Paths -- > LIbrary Search Paths --> Debug(Release)

폴더 이름 변경 하였습니다. ios --> lib



6. Frameworks에 lib 폴더 추가

   마우스로 boost lib 폴더 마우스 드래그 앤 드롭 하면 됩니다.

7. xcode에서 실행 확인



[GOOD LUCK][COCOS] 개발 환경 구성 9 - cocos2d-x - android 클라이언트 빌드 환경 구성 (ios) - boost library 적용


1. boost 빌드 스크립트 다운로드(Boost-for-Android-master)

   1) 자신이 직접 빌드
      여기에서 자신이 직접 빌드 하는 것을 공유 하겠습니다.
     https://github.com/dec1/Boost-for-Android
     위 링크에서 Boost-for-Android-master.zip 다운로드 받는다.

   2) 빌드된 파일 다운 로드
      빌드된 파일이 있으니 다운로드 하여 5. 부터 진행하시면 됩니다.


     링크 here 클릭하여 이동

   

2. Boost-for-Android-master.zip 압축 해제

  


3.build-android.sh 실행하여 boost 다운로드 및 빌드 진행



   1) https://www.boost.org에서 boost_1_69_0.tar.bz2 다운 로드 한다. 

   2) doIt.sh 파일을 오픈 한다. 

     

     - BOOST_SRC_DIR 
    자신에 환경에 맞게 빌드 파일 생성한 위치 지정


   - export ANDROID_NDK_ROOT
     자신의 경로에 맞게 수정

   
   3) 관리자 권한으로 진행 $sudo ./build-android.sh 빌드 진행

4. 빌드 완료 확인


5. cocos2d 프로젝트로 복사 진행

  boost library의  어느곳에 위치해도  문제 없으나 

  저는 관리 및 적용의 편의를 위해 프로젝트 폴더 안으로 복사 하였습니다. 


  



6 CMakeLists.txt 파일에 boost 적용

 1) include 경로 및 lib 경로 지정




  자세한 설명은 생략 합니다. 
  cmake에 boost 적용 방법에 대해 찾아 보시면 됩니다. 

 2) 라이브러리 추가 

   target_link_libraries(${APP_NAME} cocos2d ${Boost_LIBRARIES})

   ${Boost_LIBRARIES} 추가






7. boost 적용 테스트 

  1) stdafx.h에 boost 헤더 추가 


  #include <boost/format.hpp>

  


 2) HelloWorldScene.cpp 소스 구현


    std::string boostText = boost::str(boost::format("boost test = %1%") % "1.70");
    auto label = Label::createWithTTF(boostText, "fonts/Marker Felt.ttf", 24);

    



8. 실행 확인


   hello world --> boost test = 1.70 으로 text 변경 확인 할수 있습니다.

  

2019년 5월 24일 금요일

[GOOD LUCK][COCOS] 개발 환경 구성 8 - cocos2d-x - win32 클라이언트 빌드 환경 구성 (window10) - 미리컴파일된 헤더(Precomplied Header) 사용

 미리컴파일된 헤더(Precomplied Header) 사용 하는 이유는

 빌드시 속도 향상을 위해서 사용합니다. 


 프로젝트가 커지면 빌드 속도에 많은 차이가 있으니 

  꼭 사용 하는 것을 추천 합니다. 

1. Classes 폴더에 stdafx.h, stdafx.cpp 파일 생성 및 추가 

   파일 생성 및 추가 



2. 속성 페이지에  사용(/Yu) 선택

자신의 프로젝트에서 마우스 우클릭 --> 속성 --> 미리 컴파일된 헤더 선택
--> 사용(/Yu) 선택



3. stdafx.cpp 파일의 속성에서 만들기(/Yc) 선택


stdafx.cpp 파일 선택 --> 마우스 우클릭 --> 속성 선택 --> 만들기(/Yc) 선택



4. proj.win32 경로 추가 

프로젝트 --> 속성 --> VC++ 디렉터리 --> 포함 디렉터리 --> 폴더 추가 -->..\proj.win32

순서로 경로 추가 하면 됩니다. 


5. main.cpp 파일 수정


삭제 
#include "main.h"
#include "AppDelegate.h"
#include "cocos2d.h"

추가
#include "stdafx.h"




6. HelloWorldScene.h, AppDelegate.h 에서 

#include "cocos2d.h" 삭제 처리 








7. HelloWorldScene.cpp에 #include 헤더 파일 수정

삭제 
#include "HelloWorldScene.h"
#include "SimpleAudioEngine.h"

추가
#include "stdafx.h"



8. AppDelegate.cpp에 #include 헤더 파일 수정

삭제
#include "AppDelegate.h"
#include "HelloWorldScene.h"

추가
#include "stdafx.h"




9. stdafx.cpp 코드

#include "stdafx.h"

헤더만 추가



10. stdafx.h 코드



  



11. android build 수정


   1) CMakeLists.txt 파일 수정


      Classes/stdafx.cpp, Classes/stdafx.h  추가





  2) hellocpp/main.cpp 파일 수정

        삭제

       #include "AppDelegate.h"

           
       추가
         #include "stdafx.h"

   



12. xcode(iso) 적용

두개의 파일 추가만 하면 끝


앱 링크

1) ios 앱 링크       https://apps.apple.com/app/id1438419928 2) android 앱 링크       https://play.google.com/store/apps/details?id=nondeve...