[Cocos2d-x from c ++ to js] 02: solve in vs modify js source file is invalid

Source: Internet
Author: User

Previously we talked about how to import the cocos2d-x engine's built-in MoonWarriors example project into the source code, and then you can easily learn and edit.

However, I found that if I modified the js Code and click debug, the runtime will still be the previous result and will not change. What's going on?

After careful observation, I found that for cocos2d-x for js, js script is just a resource file, he will execute a batch processing when generating the project, this batch is used to copy the resource file to the corresponding directory.

650) this. width = 650; "src =" http://img1.51cto.com/attachment/201301/224850237.jpg "border =" 0 "alt =" "/>

We can see that this batch is executed only when the project is generated, that is, after the project code is modified. But as you can see before, this is a c ++ project, and js scripts only serve as resources.

So there is really no way? In fact, it is very simple. vs2010 has a generation tool selection function that uses different tools to process different file types.

Right-click the js source code file in all projects and click Properties.

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/1635093406-1.jpg "border =" 0 "alt =" "/>

 

The item type is "do not participate in generation". This is the problem. Because it is not involved, vs will not monitor the changes to this file. We changed it to "Custom generation tool"

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/163509DP-2.jpg "border =" 0 "alt =" "/>

Then, we can change the js source code and run the project in the green triangle. As you can see, the project is regenerated and vs automatically copies the js file.

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/1635093609-3.jpg "border =" 0 "alt =" "/>

 

Close

This article is from the "Old G hut" blog, please be sure to keep this source http://4137613.blog.51cto.com/4127613/1114959

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.