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