Quick-cocos2d-x Introduction Series (i)

Source: Internet
Author: User
Tags documentation lua

Since the C + + language is used in Cocos2d-x, and C + + has a high demand for developers, developers have gradually started to turn the Cocos2d-x C + + interface into Lua interfaces, thus deriving the Cocos2d-lua version. and Quick (Quick-coco2d-x) is a luxury enhanced and extended version of Cocos2d-lua, which overrides issues such as supporting code, resolving memory leaks, and only using global functions for callbacks. Quick enables developers to write games in a simple, easy-to-understand scripting language, and greatly improves development efficiency. Now Liao's big quick team has also taken over the development and maintenance of Cocos2d-lua, so the future of quick and Cocos2d-lua will be expected to be completely merged together.


After the Quick installation is complete, you can find two names of setup_mac.sh, setup_ in its root directory. Win.bat's batch scripts, which are scripts that build the Mac and Windows development environment, can automatically configure the Quick environment for you, depending on the needs of your system. After that, we can double-click the Player3 icon in the installation directory (which will generate the player's shortcut key on the Windows desktop), and start the simulator with the quick. In this simulator interface, we can create, open, and run projects, while also viewing many of the sample projects that have been brought with Quick.


quick-coco2d-x Development Tools Generally, we use the Cocos Code IDE as a development tool to quickly develop the game, where the Cocos code IDE is an Eclipse-based, cross-platform IDE specifically for Coco S2d-x Lua & JavaScript Developers prepare, through the IDE you can easily create game engineering, write and support debugging code on different platforms, real-time view of the effect of the changes in the code, and eventually released directly into a shelf-ready installation package.

However, recently learning Quick when listening to colleagues and a lot of user feedback said: Quick-coco2d-x v3.3 Final This version has some bugs on the Cocos Code IDE, and the execution is relatively slow. So in the great God's recommendation, this tutorial we do not choose the Cocos Code IDE as a development tool, but use another efficient way to complete the development of the Parkour game--sublime + Quickxdev.


engine Catalog Structure Analysis opens the Quick installation directory, which is structured as shown in the following figure:

Build: This directory is the project storage directory for cocos2d-x. Cocos: The folder contains most of the engine's library files, including: 2d, 3d, sound, base library, math library, physical library and so on a series of related class files. Docs: This folder contains documentation for the engine's API documentation, the release of the document (the latest version changes, the running environment requirements, the compilation environment requirements, and instructions on how to run the test case), the Cocos Programming specification, and so on. It allows us to view the code API for the engine, as well as the latest version of the changes introduced, the quick run environment requirements, the compilation environment requirements and how to run the test case related commands. Many of the files inside are in HTML and MD format. Extensions: The main one is the GUI extension library. External contains third-party libraries of physics engines, box2d and Chipmunk, database third-party libraries, Sqlite3, network third-party libraries, webp,websockets, and some other third-party libraries, such as encoding conversion libraries, data format libraries, and so on. The licenses contains the various license files used in the engine. The SPIDERMONKEY-JS operating environment used in the License_spidermonkey,spider engine requires this license, which applies to several MPL/GPL/LGPL licenses License_chipmunk,license_ Js,license_lua and so on. Under these licenses, the engine can make arbitrary copies and modifications to the corresponding source code. Quick: This is the Quick Engine code. It contains the batch tool for creating new projects for each platform, the core directory of the Quick framework, 2DX and some other dependent C + + files, template engineering, Quick's examples, and so on Quick's core files. Readme.html/readme.md:quick's usage guide, the installation, use, creation and so on of quick information can be obtained here, it is actually equivalent to the directory of documents in Docs. SETUP_MAC.SH: Build a script for the MAC development environment. Setup_win.bat: A script to build the Windows development environment. The Tools:quick is used as a luabinding tool to export custom C + + classes. Version: New Project directory structure Analysis opens the directory for the new project, and we analyze the directory structure of the new project, as shown in the following figure:

Config.json: Project information configuration file. Debug.log: The project log, which is the output of all the log files for the Print console window. Frameworks: Store Cocos2d-x engine core code and various platform runtime resources. Res: the folder where the project resources are stored, that is, all the images, fonts, audio and other resources used in our game development are put here. Runtime: Stores the precompiled run-time library. SRC: The project source folder, that is, all the. Lua files in the game are put here.

The above directory res and SRC folder is the most wanted, in development we just need to operate on the contents of these two folders, you can realize the development of the game.

In the SRC folder of the new project, now you can see some. lua files, these are the LUA code for our project. Next we briefly introduce the functions of each of the following src: The core of the Cocos:cocos Engine code Framework:quick, a set of framework Config.lua built on COCOS2D-X basis: The project configuration file, Including resolution adaptation and other information Main.lua: Project Portal app: Project interface and other files, store our game code Myapp.lua: The first interface of the game scenes: The folder that holds the code of each scene of the game Mainscene: the first scene of the game

Reprinted from http://shannn.com/archives/371

Related Article

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.