Cocos2d-x + lua development mode editor selection, cocos2d-xlua

Source: Internet
Author: User

Cocos2d-x + lua development mode editor selection, cocos2d-xlua

CocosIDE was originally intended to be used directly. After all, it was officially produced and supports Android remote debugging. debugging in windows is also very convenient, debugging information is comprehensive, and smart prompts are also good. Well, everything looks perfect, but it has a fatal defect that inherits the consistent feature of eclipse-"card ". I have never been used to eclipse written based on java. On the one hand, the shortcut keys are different from those of vs, and I am too lazy to configure them. (If he can delete duplicate shortcuts like IntelliJ IDEA, he can easily delete them, I am still interested in configuring it, but there are no prompts for repeated shortcut keys, but there will be various problems in the use process). On the other hand, the memory usage is high, and the problem is stuck. I often put two letters in IDE for a second or two. When I needed code prompts, I had to finish it. Writing code with CocosIDE is not easy, and you are upset about it.

So I spent an afternoon trying several good Lua editors, but they all have their own advantages and disadvantages. Unlike c ++, vs + va is almost perfect.

1. IntelliJ IDEA Community Edition

This is the same as eclipse, but there are a lot of excellent ides in all aspects. Android later developed an Android Studio based on this to try to replace the eclipse-based ADT.

The advantage is that the performance is excellent and the code prompt is convenient (the prompt is displayed directly during the hand-hitting process, and there is almost no lag ). If I am a java developer, it is the best choice.

However, I tried its lua plug-in and it doesn't feel very useful. On the prompt, it is more like a text editor than a smart IDE (reasonable, after all, just a plug-in), which is much worse than CocosIDE. In theory, setting up the lua prompt file (which is different from the cocoside format and has little information, for example, there is no function parameter information or return value information) can achieve the desired effect. But unfortunately I won't ......


2. Lua Studio

This seems to be written by Chinese people. Very good, fast, and the code prompt is also very good. The version of cocos2d-x 3.x is supported directly. It also supports functions such as outline. However, it has a fatal problem, that is, it does not have the function of directly running the program, but only the function of debugging the program. The run time program connecting the debugging program to CocosIDE is very slow. It takes 10 seconds to start the program. I write the lua program and debug it occasionally, but the running program must be regular. I cannot accept this. Of course, I can also use it as a pure lua text editor to directly run the program. However, I have to modify the run time Code and add the log information to the Console window. Otherwise, I do not know where the error occurs.

I think that even if I do 99%, a poor job may lead to user loss. Even this is not necessarily a problem with the software itself. It may be that the user is ignorant or misoperations. But the reality is that users are lost. It is useless to say "this is not my fault" for many times. The same is true for games with software.


3. Bade vs plugin

This is a vs plug-in that also provides debugging functions. It can be embedded well with. The disadvantage is that there is no real code prompt. Only prompts entered in this file.


4. Sublime Text3

I tried a few unpleasant things and finally returned to Sublime Text. I used Vim but used Sublime Text, so I don't want to touch Vim. It is also a cross-platform editor that supports various plug-ins and powerful functions, why don't I use a simple and beautiful one, but I think that an editor should be divided into three operation modes, that is, a tall one?

Of course, although Vim is extensible, it is essentially a text editor rather than IDE. However, writing lua scripts is also not about writing c ++ code, and does not require any powerful IDE support.

Sublime itself has some support for lua, And the editor itself has powerful functions such as code completion, file search, file jump, and content jump, so there is no problem with the basic functions. There is also a QuickXDev plug-in for quick-cocos2dx development. But because the cocos2-x v3 lua binding method has changed, so the native code prompt for the cocos2d-x has not been completed, only the lua part.

In addition, I added a Cocos2dx Build option, saying "Build" is actually running the Runtime program. Logs can be output directly in Sublime.

Select Tools -- Build -- New Build System, copy the following code, and save it. Then you can select this Build.

{    "cmd": ["E:\\Code\\runtime\\win32\\game.exe", "$file"],    "file_regex": "^(?:lua:)?[\t ](...*?):([0-9]*):?([0-9]*)",    "selector": "source.lua",    "shell": true,    "working_dir" : "E:\\Code\\runtime\\win32"}

Cmd is the program directory. If shell is true, the program is displayed independently. Otherwise, the command line output is in sublime. working_dir is the working directory (Resource Directory) as the name suggests ).


Summary: there is no perfect editor for the moment. I plan to use Sublime Text3. Although it is not perfect, it has excellent scalability and is almost perfect for text editors.


How to combine cocos2d-x with Lua to use specific points

The cocos2d-x comes with the lua engine. Look at this. Although it is English, it is easy to understand.
Cocos2d-x NEW Lua Engine README
Main features
Support autorelease CCObject object.
Call Lua function from C ++ (local, global, closure), avoid memory leaks.
Add CCNode: setPosition (x, y), CCNode: getPosition () huge performance boost.
Remove needless class and functions from tolua ++. pkg files, improved performance.
CCMenuItem events handler.
CCNode onEnter/onExit events handler.
CCLayer touch & multi-touches events handler.
Check the two connections.
Www.cocos2d-x.org/..uments
Scripting and Translating between Programming ages

When cocos2dx is developed in vs2012 and lua is called, an error is returned.

Check whether the path of luaXML. lua LuaXML_lib.lua is the same as that of require ("luaXML"). The error message is that the file cannot be found!

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.