Cocos_Code_Ide (1): Understand proj. win32, proj. win32 of frameworks under the Cocos Lua Project

Source: Internet
Author: User

Cocos_Code_Ide (1): Understand proj. win32, proj. win32 of frameworks under the Cocos Lua Project

For the first time, I did not know whether it was useful or not. I accepted criticism from everyone. Do not spray. Thank you.

 

1. First, create a project

---------------------------------------------------------------------------

 

---------------------------------------------------------------------------

---------------------------------------------------------------------------

2. Use VS to open the. sln file under proj. win32 and compile it again.

After successful

The code for the above scenario is implemented by main. lua.

---------------------------------------------------------------------------

 

3.Next, we need to implement Cocos Code Ide and VS communication.

First, set Build Win32 Runtime. In Cocos Code Ide, right-click the project name --- Select Cocos Tools --- Select Build M Runtimes

Select"Build Win32 Runtime ", and wait for completion.

 

After this is done, your project name "cmd.exe" appears in runtime -- win32 under your project directory.

 

 Click Debug Configurations.

Then Apply -- Debug. The farm screen is displayed.

---------------------------------------------------------------------------

 

4. However, I want to use my own scenario.

Add the familiar HelloWorld class in VS (implement it by yourself)

I want to delete the code of the file in main. lua, and only

In this case, in AppDelegate: applicationDidFinishLaunching () of VS, add a sentence

CCLOG ("test ");

Then save it. In Cocos Code Ide, right-click the project --- Easy Shell --- Open... and enter cocos compile-p win32 to run

 

The test that was just added will appear.

Note:The cocos compile-p win32 command does not need to be set in Cocos Code Ide after you frequently modify the C ++ Code.

Remember to save it after modifying the C ++ code.

---------------------------------------------------------------------------

5. Next, replace your scenario. Generally, create and runwithscene () in applicationDidFinishLaunching () of AppDelegate (),I tried it and found it difficult. Later I found that the scenario entry contains a startRuntime () function in the Runtime. cpp file.

 

Replace the scenario in it with the HelloWorld scenario, and comment out the following two lines. ConnectWaitLayer is a Layer implemented above, that is, a Layer with an IP address that we saw at the beginning,

Save and enter cocos compile-p win32 to run the program. The scenario you want will appear.

If you are in HelloWorld. in the init () function of cpp, only one background layer is added and the location is set. After running, the background layer is normal and then zoomed in. in lua

Cc. Director: getInstance (): getOpenGLView (): setDesignResolutionSize (480,320, 0). Just comment it out.

 


Call the cocos function in LUA

You should call it in a specific ccnode object
For example, if you use a texture to create a sprite
Use this sprite to call the function.

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.