1. Trang chủ
  2. » Công Nghệ Thông Tin

Install Cocos2d in window Team V

37 233 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 37
Dung lượng 1,49 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Whats cocos2dx? Cocos2dx is a game engine branched from Cocos2diPhone, which consists of expanding supported platforms, with multiple choice of programming languages thats shares the same API structure.

Trang 1

Install Cocos2d in window

Writer: Team V

Trang 3

● What's cocos2dx?

Cocos2d-x is a game engine

branched from Cocos2d-iPhone, which consists of expanding

supported platforms, with multiple choice of programming languages thats shares the same API

structure.

Trang 4

http://dl.google.com/android/ndk/android-ndk-r8e-Cygwin: http://cygwin.com/setup.exe

Trang 5

Setup tools.

Cocos2dx package: unzip package that we have just download

Build package:

2 option: (only use one of them)

1 Build by build-win.bat: Go to root folder of

cocos2d and run build-win32.bat

2 Use Visual Studio 2010: Open

cocos2d-win32.vc2010.sln in root folder of cocos2d and

build all project in this solution

Trang 6

Setup tools.

Android NDK package: unzip this package

Install Cygwin: open setup.exe, when we meet

“select package” screen, we choose the same at below image

Trang 8

Ex: InstallWizardForVC2010Express for Visual

Studio Express 2010

Trang 11

Build native code for project: Run build_native.sh in prject, in cygwin terminal you must go to current path of project and run “build_native.sh”

Ex: sh build_native.sh

Trang 12

Import project to eclipse and run on emulator

Enjoy!

Trang 13

Errors that we can meet.

Config wrong paths for android sdk, android ndk, cygwin, etc

Cannot run on emulator: open virtual device in device manager and check “USE HOST GPU”

Trang 14

Tip: setup crossplaform project

In tutorial above we can create android project

So we need create win32 project that use source code the same at android native source code

Step1: create android project

Trang 15

Step 2.1: in VS create win32 project that have the same name android project

Complete

Trang 16

Step 2.2: If you choose ‘Create new solution’, go to step 3

Trang 17

Result of step 2.2:

Trang 18

Step 3: delete *.opensdf, *.sdf, *.sln, *.suo

– Result:

Trang 19

Step 4: move “proj.win32” to the same struct folder

as proj.android

Trang 20

Step 5: open proj.win32 by VS and save solution file

in coco2sx root path

Trang 21

Tip: Config “include” path for VS

open <project name>.win32.vcxproj by notepad++

Find <AdditionalIncludeDirectories> tag, and add

folder path that VS need search it to find “include” file

Trang 22

Tip:How to setup in Eclipse to work with C++

Trang 23

First, we need install C++ to Eclipse:

Go to Help/Install New Software

In “Work with” dropdown, select your eclipse version.

Finding “Programing Languages” and select

“C/C++ Development Tools” and “C/C++

Development Tools SDK”

Click Next and install them.

Trang 25

We have the android project after create by “create-android-

project.bat” and build by Cygwin throught “build_native.sh”.

Now, we’ll import that android

project to Eclipse.

Trang 26

Then, select the project.

File->New-> Other

Select “Convert to a C/C++

Project (Adds C/C++ Nature” And Click Next

Trang 27

Select “Make file project” and select

“Other toolchain”

Click “Finish”

Trang 28

Right click in your project->

Properties

In “C/C++ Build” , modify like the

image below with “HelloCaiTo” be replace by you project name

Trang 29

Next, in “C/C++ General” ,select

“Paths and sysbols”

In “Includes” tab , select “GNU C+ +”

Click “Add ”

Trang 30

-After click “Add ” ,choose “File system” and select to your android

NDK->platforms->{Select your android version} ->arch-arm->usr->include

Click OK

-And add the same with {Location of cocos2d-x}/cocos2dx/include (see image) -Click “Apply” and rebuild project

Trang 31

Then, go to “Source Location” tab

First it do not contain the “Classes” and the “cocos2dx” like the image.

Trang 32

We need to add to your project.

Select “Link Folder ”

Check “Link to folder file system ” and

“Browse ” to your “Classes” folder in your

project-> “OK”

Do the same with your “cocos2dx” folder in the location which you save your cocos2d-x

- Click “Apply”

Trang 33

Modify NDK root/build/core/build-binary.mk

Go to line: 49

Change: $(cleantarget):

PRIVATE_CLEAN_FILES := ($(my)OBJS) To: $(cleantarget):

PRIVATE_CLEAN_FILES := $($

(my)OBJS)

Trang 34

There is a second issue that only affects Max OS X

developers using the 64-bit NDK (i.e the download

with the file name

android-ndk-r8e-darwin-x86_64.tar.bz2) The fix is trivial and requires you to make the following one-line changes to these two files:

Trang 35

{ANDROID_NDK_root}/build/core/init.mk: Re place line 229:

ifneq (,$(shell file -L $(SHELL) | grep

‘x86[_-]64′))

with this:

ifneq (,$(shell file -L $(SHELL) | grep

‘[xX]86[_-]64′))

Trang 36

Now, clean your project and run

Ngày đăng: 17/07/2017, 14:32

TỪ KHÓA LIÊN QUAN