cocos2d-x & CocoStudio UI使用


1.添加头文件和引用
#include "CocosGUI.h"
#include "cocostudio/CocoStudio.h"

using namespace gui;
using namespace cocostudio;

备注: 需要引用namespace gui 和 cocostudio
namespace gui 包含的所有UI元素为cocostudio界面上拖动的所有元素所在的命名空间中;
cocos2d-x 需要引入cocostudio UI编辑导出后的json, 需要引入namespace cocostudio;

2.在Layer::init()方法中,添加cocostudio 导出的AirPlane.ExportJson json文件,
代码如下:
 
UILayer* uiLayer = UILayer::create();
    
auto myLayout = cocostudio::GUIReader::shareReader()->widgetFromJsonFile("AirPlane/AirPlane.ExportJson"); //alpha1中使用 
    
uiLayer->addWidget(myLayout);      
this->addChild(uiLayer);

参考:
http://blog.csdn.net/fansongy/article/details/16950241
http://blog.csdn.net/fansongy/article/details/12757411
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值