Cocos2D-X

Cocos2D-X is a high-performance cross platform 2D/3D game engine that supports multiple platforms such as iOS, Android, WinXP/7/8, WP8, BlackBerry, MeeGo, Marmelade, WebOS, macOS. This page will focus on properly configuring this package for initial usage for the most part. Other documentation is linked in #See also.

Installation

Install the cocos2d-x-srcAUR package.

Configuration

$PATH

If you install manually, add /your-cocos2d-x-dir/tools/cocos2d-console/bin, and /your-cocos2d-x-dir/tools/cocos2d-console/plugins/plugin_package to your $PATH environment variable mostly to run the cocos python2 script to create projects, and also run sdkbox respectively.

If you use the version from AUR, package will automatically add all the necessary environment variables to the $PATH. After installation, you need to reload the environment variables from /etc/profile. You can do it manually:

source /etc/profile

or just reload your session.

Python scripts workaround

Since some Cocos2D-X scripts use python2 instead of python3 (and does not plan to move from it), like sdkbox, simply calling will not suffice since other modules will be called with which points to python3. To avoid this, install the version from AUR, or change script headers. Do not forget to add /usr/local/bin, or whichever directory the workaround shell script is installed at, before in your PATH environment variable. The following should suffice:

export PATH=/usr/local/bin:${PATH}

Here is an example shell script workaround:

Disable sending usage data

Sending the usage data can be disabled setting to false in :

# sed -e 's/enable_stat=.*/enable_stat=false/g' -i /opt/cocos2d-x/tools/cocos2d-console/bin/cocos2d.ini

Cross Compiling for Android

Install , , and , and also add the following to your shell configuration file:

export NDK_ROOT=/opt/android-ndk
export ANDROID_SDK_ROOT=/opt/android-sdk
export ANT_ROOT=/usr/bin

The tool should suffice to fetch the SDK platform for a certain android version, however there are also packages in the Arch User Repository such as for downloading these SDK platforms.

Updating SDKBOX

Cocos2D-X comes with a tool called sdkbox for integrating third party software development kits into projects easily. To update this tool, you must have read/write/execute access to /opt/cocos2d-x/tools/cocos2d-console/plugins/plugin_package and the following files in that directory: sdkbox, ,

For a single-user configuration, executing the following will suffice:

# chown $USER:$USER /opt/cocos2d-x/tools/cocos2d-console/plugins/plugin_package/{,sdkbox,sdkbox.bat,sdkbox.pyc}
$ sdkbox update

Cocos2D-X Development Notes

Creating a Scene with Physics

As of Cocos2D-X version 3.14, the HelloWorldScene.cpp and templates have been updated in cocos2d-x-srcAUR to reflect the the fact that has been deprecated. See issue #16941 in the official Cocos2D-X repository.

In order to create a with physics, line 16 of must be changed to the following:

gollark: You can, however, store bees in it.
gollark: Technically it doesn't really manage bees as much as act as my eternally unfinished notes system.
gollark: Such as my Bee Management Systemâ„¢.
gollark: I can only help you with misuses of Lua, or projects using at least forty (40) JS frameworks.
gollark: My new Bee Management Systemâ„¢.

See also

This article is issued from Archlinux. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.