#include "ui\CocosGUI.h"
#include "cocostudio\CocoStudio.h"

using namespace cocos2d::ui;
using namespace cocostudio;

//读取csb文件

auto ui = CSLoader::createNode("MyScene.csb");

 

//获取cocostudio的按钮空间,并给btn指针
Button* btn = (Button*)ui->getChildByName("MtBtn");

//获取控件对象
LoadingBar* m_hpBar = (LoadingBar*)UI->getChildByName("hpBar");

//获取图片对象

ImageView* m_xiaoruoImg = (ImageView*)UI->getChildByName("xiaoruoImg");

//添加单击监听
m_hpBar->addTouchEventListener(this, toucheventselector(HelloWorld::onClick));

 

相关文章:

  • 2021-12-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-20
  • 2022-01-30
  • 2021-08-07
  • 2022-03-08
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-02-04
  • 2022-12-23
  • 2022-12-23
  • 2021-09-27
相关资源
相似解决方案