Windows Installation and Setup

Prerequisites

A supported environment. See Installation Prerequisites

Setting up Cocos2d-x

You can get started with Cocos2d-x by either downloading a self-contained .zip from the website or by cloning our GitHub Repo. Pick what works for you. There is no need to do both. Make sure you have a working environment. This means a working Python, having run /setup.py> and updated your $PATH.

By downloading a .zip archive

  • Download Cocos2d-x and unzip it. (maybe: c:\Users\your_user_id)

Cloning from GitHub

Use the following commands to clone our GitHub repo and get your environment setup. If you are not familar with GitHub's workflow, learn it or download using the step above, By downloading a .zip archive.

c:\<to where you want to clone this repo>

git clone git@github.com:cocos2d/cocos2d-x.git

git submodule update --init

git submodule update

./download-deps.py

Compile and run the cpp-tests project

Use cmake

cd COCOS2DX/tests/cpp-tests
mkdir win32-build
cd win32-build
cmake ..
make

Use Visual Studio

First use CMake to generate Visual Studio project,

cd COCOS2DX/tests/cpp-tests
mkdir win32-build
cd win32-build
cmake .. -G"Visual Studio 15 2017" -Tv141

then open cpp-tests.vsproj and select cpp-tests to run.

Use cocos command line tools

cd COCOS2DX/tests/cpp-tests
cocos run -p win32

Starting a new project

Once everything above works, you can start a new project! To do this, read our document on the Cocos Command-line tool.

Distributing a Cocos2d-x app on Windows

Note: this falls outside of the realm of Cocos2d-x. Please consult Microsoft resources for assistance.

If you try to run a game created with Cocos2d-x on a non-development machine, it may be required for this machine to have the Visual Studio runtime installed. The easiest way is to create an installer for your game, but it is possible to do it without by installing all required pieces manually.

  • Use Dependency Walker to check what DLLs your game requires.

  • Install the required Visual Studio runtime. Microsoft has now merged VS2015, 2017 and 2019 runtimes into one, which you can find here.

For the installer, check these posts:

  • InnoSetup (also shows you a sample for how to install the VS C++ runtime using it).

  • Sample InnoSetup script for Cocos2d-x here.

Troubleshooting

Please see this F.A.Q for troubleshooting help.

results matching ""

    No results matching ""