Cocostudio using note 1:cocos2dx3.4 to load Cocostudio exported CSB files

Source: Internet
Author: User

has always been using handwritten code to do the COCOS2DX game interface. See friends one weeks a game speed, very let me jealous. Their company is using cocosbuilder to do the interface. For Cocosbuilder in his recommendation I also studied for one weeks, the online tutorial is too messy, and too many pits, each tutorial operation is not the same, according to the tutorial or not, I decided to a little bit to pits. This note is the application of the CSB file generated by the cocostudioV2.3.2 version in cocos2dx3.4 . For Cocosbuilder notes after a few days in the finishing, climb the pit crawl heart tired.

Cocostudio has been integrated in the Cocos engine, download the Cocos engine on the official website.

650) this.width=650; "title=" 1452062075209302.png "alt=" cocos2dx3.4 load cocostudio exported CSB file 1.png "src="/HTTP/ Www.byjth.com/content/uploadfile/ueditor/upload/image/20160106/1452062075209302.png "/>

According to their own platform to choose,mac version I did not use.

650) this.width=650; "title=" 1452062097813803.png "alt=" cocos2dx3.4 load cocostudio exported CSB file 2.png "src="/HTTP/ Www.byjth.com/content/uploadfile/ueditor/upload/image/20160106/1452062097813803.png "/>

When installed, click the Cocos engine icon to start the engine. After starting, we select New project in the upper right corner to open the new project interface. Here you can choose an empty project, or see an example of the system's own.

650) this.width=650; "title=" 1452062118442449.png "alt=" cocos2dx3.4 load cocostudio exported CSB file 3.png "src="/HTTP/ Www.byjth.com/content/uploadfile/ueditor/upload/image/20160106/1452062118442449.png "/>

Here I choose the "menu sample" that comes with it and click "Next" in the lower right corner.

650) this.width=650; "title=" 1452062131514683.png "alt=" cocos2dx3.4 load cocostudio exported CSB file 4.png "src="/HTTP/ Www.byjth.com/content/uploadfile/ueditor/upload/image/20160106/1452062131514683.png "/>

After you set the project name and the project save path, click Finish to start Cocostudiosuccessfully.

650) this.width=650; "title=" 1452062209262724.png "alt=" cocos2dx3.4 load cocostudio exported CSB file 5.png "src="/HTTP/ Www.byjth.com/content/uploadfile/ueditor/upload/image/20160106/1452062209262724.png "/>

650) this.width=650; "title=" 1452062215115152.png "alt=" cocos2dx3.4 load cocostudio exported CSB file 6.png "src="/HTTP/ Www.byjth.com/content/uploadfile/ueditor/upload/image/20160106/1452062215115152.png "/>

There are many tutorials on the use of Cocostudio , and there is no explanation here. I'll take notes again when I use them.

This article is mainly about the CSB file exported using cocostudio in cocos2dx3.4 . Here I use the example of the system directly.

1. Select the "Publish and Package" submenu under the "Project" menu on the menu bar.

650) this.width=650; "title=" 1452062272352126.png "alt=" cocos2dx3.4 load cocostudio exported CSB file 7.png "src="/HTTP/ Www.byjth.com/content/uploadfile/ueditor/upload/image/20160106/1452062272352126.png "/>

2, in the publishing and packaging interface, select Publish resources, default.

650) this.width=650; "title=" 1452062291162012.png "alt=" cocos2dx3.4 load cocostudio exported CSB file 8.png "src="/HTTP/ Www.byjth.com/content/uploadfile/ueditor/upload/image/20160106/1452062291162012.png "/>

3, after the successful release, there will be text prompts,.

650) this.width=650; "title=" 1452062306909540.png "alt=" cocos2dx3.4 load cocostudio exported CSB file 9.png "src="/HTTP/ Www.byjth.com/content/uploadfile/ueditor/upload/image/20160106/1452062306909540.png "/>

So far, the interface we made with Cocostudio has been successfully exported. Ps: Here we are opportunistic.

Below we use cocos2dx to load our exported CSB file.

1, first create the cocos2dx project.

Specific reference:

COCOS2DX Learning Note 1: Creating a Game Project solution

Http://www.byjth.com/biji/10.html

2. Find the CSB file We generated and the materials used,theCSB file under our cocostudio Project Path Res folder.

650) this.width=650; "title=" 1452062384461208.png "alt=" cocos2dx3.4 load cocostudio exported CSB file 10.png "src="/HTTP/ Www.byjth.com/content/uploadfile/ueditor/upload/image/20160106/1452062384461208.png "/>

3. Copy to the Resources directory of the cocos2dx project . Note the copy of the footage, otherwise it cannot be displayed.

650) this.width=650; "title=" 1452062439412445.png "alt=" cocos2dx3.4 load cocostudio exported CSB file 11.png "src="/HTTP/ Www.byjth.com/content/uploadfile/ueditor/upload/image/20160106/1452062439412445.png "/>

4. Add the CSB file in the cocos2dx code .

Open the HelloWorldScene.cpp file, and then join the header file and namespace that called Cocostudio .

#include "Cocostudio/cocostudio.h"

#include "ui/cocosgui.h"

using namespace cocostudio::timeline;

650) this.width=650; "title=" 1452062406389662.png "alt=" cocos2dx3.4 load cocostudio exported CSB file 12.png "src="/HTTP/ Www.byjth.com/content/uploadfile/ueditor/upload/image/20160106/1452062406389662.png "/>

5. Then add the code that loads the CSB file to the init () method.

auto RootNode = Csloader :: CreateNode ( "MAINSCENE.CSB"

This ->addchild (rootNode);

650) this.width=650; "title=" 1452062466949472.png "alt=" cocos2dx3.4 load cocostudio exported CSB file 13.png "src="/HTTP/ Www.byjth.com/content/uploadfile/ueditor/upload/image/20160106/1452062466949472.png "/>

6. Start the debugger to see the effect of running.

650) this.width=650; "title=" 1452062490737235.png "alt=" cocos2dx3.4 load cocostudio exported CSB file 14.png "src="/HTTP/ Www.byjth.com/content/uploadfile/ueditor/upload/image/20160106/1452062490737235.png "/>

Here my project set the simulator resolution is 320*480 so loading display has a problem. There will be time for us to discuss the problem of resolution adaptation. 1 months 6 days.


Cocostudio using note 1:cocos2dx3.4 to load Cocostudio exported CSB files

Http://www.byjth.com/tools/41.html


This article is from the "Close your eyes on the Dark" blog, please be sure to keep this source http://byjth.blog.51cto.com/4127898/1758976

Cocostudio using note 1:cocos2dx3.4 to load Cocostudio exported CSB files

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.