explaingit

cocos2d/cocos2d-x

19,010C++Audience · developerComplexity · 4/5StaleLicenseSetup · hard

TLDR

Open-source C++ game engine for building 2D games across iOS, Android, macOS, Windows, and Linux with a single codebase.

Mindmap

mindmap
  root((cocos2d-x))
    What it does
      Renders 2D sprites
      Manages scenes
      Handles input
      Physics simulation
    Platforms
      iOS
      Android
      macOS
      Windows
      Linux
    Tech stack
      OpenGL ES
      Metal
      Box2D
      Chipmunk
    Use cases
      Mobile games
      Desktop games
      Interactive apps
    Languages
      C++
      Lua bindings
      JavaScript bindings

Things people build with this

USE CASE 1

Build a 2D mobile game that runs on both iOS and Android from a single C++ codebase.

USE CASE 2

Create a desktop game with physics-based gameplay using integrated Box2D or Chipmunk engines.

USE CASE 3

Develop an interactive app with sprite animations, scene transitions, and touch input handling.

USE CASE 4

Port an existing game to multiple platforms without rewriting the core game logic.

Tech stack

C++OpenGL ESOpenGLMetalBox2DChipmunkLuaJavaScript

Getting it running

Difficulty · hard Time to first run · 1h+

Requires C++ compiler, multiple platform SDKs (iOS/Android), and native build tools; cross-platform compilation adds significant setup overhead.

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

In plain English

Cocos2d-x is an open-source, cross-platform game engine used to build 2D games, interactive apps, and graphical experiences. You write the game logic once in C++ (with optional bindings for Lua or JavaScript), and the same code compiles and runs on iOS, Android, macOS, Windows, and Linux. The engine handles the hard parts of game development for you: rendering sprites (the images that make up game characters and environments), managing scenes and transitions between screens, handling touch and keyboard input, playing sounds, simulating physics, animating skeletons, and more. Under the hood it uses OpenGL ES on mobile devices, standard OpenGL on desktop, and Metal on Apple platforms for hardware-accelerated 2D rendering. It includes integration with the Box2D and Chipmunk physics engines for realistic movement and collisions. You would use cocos2d-x if you are building a 2D mobile or desktop game and want a mature, production-proven engine with a large community behind it. It served as the foundation for the newer Cocos Creator editor-based engine. Note: the project's own README recommends that new users start with Cocos Creator rather than cocos2d-x for a more modern workflow. The existing engine is written in C++ and licensed under the MIT open source license.

Copy-paste prompts

Prompt 1
How do I set up a new cocos2d-x project and create a simple sprite that responds to touch input?
Prompt 2
Show me how to use Box2D physics in cocos2d-x to make a character fall and collide with platforms.
Prompt 3
What's the best way to organize scenes and transitions in a cocos2d-x game with multiple levels?
Prompt 4
How do I compile and run a cocos2d-x game on both iOS and Android from the same C++ source code?
Prompt 5
Can you explain how to load and play animations and sound effects in cocos2d-x?
Open on GitHub → Explain another repo

Generated 2026-05-18 · Model: sonnet-4-6 · Verify against the repo before relying on details.