Setup, compilation and use of the COCOS2DX game engine under Ubuntu

Source: Internet
Author: User
Tags versions python script linux

COCOS2DX is a two-dimensional game engine based on C + + OpenGL open source free support Cross-platform publishing including Windows Linux Android Apple et cetera I want to get started with a two-dimensional engine learning to play a game should be a good choice and this engine works a lot especially domestic works such as the history of the most pit dad swim Play Fishing talent (the game author also specifically used this game as an example to write a tutorial) because personal preferences have been like in Linux (my Ubuntu) to build a variety of platforms this time is no exception through a variety of Baidu Google find documents finally set up from the notes to share

One engine directory analysis

First download engine source Open View directory structure

Related SLN files don't have to talk to them obviously is vs template file

build-nacl.sh file I've never really understood what I'm doing. Ask the kind-hearted person or related person to help translate this document annotation English (I do not use this file)

#!/bin/bash

2 # Build script to build all components for Native Client.

3 #

4 # By default this script would only build debug versions.

5 # Pass ' All ' as an argument to build clean and also builds

6 # Release CONFIG.

7 #

8 # Before running this script for your need to set Nacl_sdk_root

9 # and add the NaCl compiler Bin folder to your path.

10 #

# There are several libraries from naclports that are

# Prerequisite for building cocos2dx on NaCl. The simplest

# Way to build them be to checkout naclports and run:

# $ make PNG TIFF FreeType XML2 freealut JPEG Vorbis ogg

install-deps-linux.sh If your computer is using Deb (Ubuntu debain Deepin), this program will automatically download the libraries you need to compile the source code.

Makefile Makefile file compiled source code but this Makefile by default only compile release version does not produce debug version

Make-all-linux-project compiled source code The description of this file says it's faster than make and tested to generate debug and release two versions of the library

Second compilation engine:

Note: The game engine source code has a few lines of nonstandard (what variable definition is not initialized, and so on) but also use the-werror option so before compiling the original makefile of the game compilation will be cocos2d/cocos2d-x-2.2.2/cocos2dx/ Proj.linux/cocos2d.mk inside the-werror to remove otherwise compile will not pass (-werror means compile warning as an error is if there is a warning compiled will not be passed)//This one for at least half an hour of Google Baidu Finally in an English document found in a similar error and found a few hours to the wrong file to find a hard ah

This step is very simple and best implemented. /make-all-linux-project This one can perform debug and release two libraries for ease of use (performing make only produces release is not not possible)

After compiling the Lib directory, there is a stack of Linux libraries.

To this compilation complete

Three Create a project

There's a tools folder in the directory that uses the Project-creater in this folder.

There's a Create_project python script that directly python create_project.py found needed to add parameters and then follow the parameters

Python create_project.py-language cpp-project mygame-package com.yujiaao.mygame

(In fact, this is also the Linux benefits of Windows to install Python)

This will create your project in the engine's project directory.

Four compile project----Linux native release (almost no one in this country has ever written a completely personal test)

Because it is a cross-platform project, the directory of the project seems to be a bit of a miracle (at least I think it's hard to have an IDE to identify it) classes is storing project source code (project core source platform independent) resources A few proj related files are the platform release code.

Linux under the compiler relatively simple to enter Proj.linux will find that there is a build.sh and a makefile

Actually execute./build.sh and make function almost as much as one will produce the debug version one will produce release version and build.sh seemingly can be used directly without compiling the engine (first compile the engine and compile the source code you write)

When the compilation is complete, you will find that there is a bin directory inside the Proj.linux and there will be a debug (release) inside there is a program that can be executed

Five compiler projects----Android compilation (this part is mainly to see the proj.android inside the readme as long as the Readme read this part of the OK and the Red Line part of the note do not copy to their own workspace do not change the directory structure)

The first suggestion is to use the ADT (that is, the one on Google's website directly with Eclipse) to configure it (there is one more reason the eclipse plugin has a special card, especially if you have other plug-ins on your eclipse).

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.