手机
当前位置:查字典教程网 >编程开发 >C语言 >Cocos2d-x UI开发之CCControlPotentiometer控件类使用实例
Cocos2d-x UI开发之CCControlPotentiometer控件类使用实例
摘要:CCControlPotentiometer是电位计按钮,和CCControlSlider的用法很相似。关于控件使用时的一些配置,请参见文章...

CCControlPotentiometer是电位计按钮,和CCControlSlider的用法很相似。关于控件使用时的一些配置,请参见文章:UI开发之控件类-CCControlButton。

Cocos2d-x UI开发之CCControlPotentiometer控件类使用实例1

bool HelloWorld::init() { bool bRet = false; do { CC_BREAK_IF(!CCLayer::init()); //CCControlPotentiometer参数是底座,进度条,控制按钮图片资源 CCControlPotentiometer * potentiometer = CCControlPotentiometer::create("potentiometerTrack.png", "potentiometerProgress.png","potentiometerButton.png"); //设置最大值和最小值以及初值 potentiometer->setMaximumValue(100.0); potentiometer->setMinimumValue(0.0); potentiometer->setValue(50); potentiometer->setPosition(ccp(240,160)); this->addChild(potentiometer); //添加事件监听 potentiometer->addTargetWithActionForControlEvents(this,cccontrol_selector(HelloWorld::valueChanged), CCControlEventValueChanged); bRet = true; } while(0); return bRet; } void HelloWorld::valueChanged(CCObject * pSender,CCControlEvent controlEvent) { CCControlPotentiometer * potentiometer = (CCControlPotentiometer *)pSender; CCString * string = CCString::createWithFormat("%f",potentiometer->getValue()); CCLog(string->getCString()); }

【Cocos2d-x UI开发之CCControlPotentiometer控件类使用实例】相关文章:

关于C/C++中static关键字的作用总结

如何判断一个数是否为2的幂次方?若是,并判断出来是多少次方?

operator new在C++中的各种写法总结

关于STL中的map容器的一些总结

浅析c#中WebBrowser控件的使用方法

C语言宏定义使用分析

VC中Tab control控件的用法详细解析

深入理解C++的动态绑定与静态绑定的应用详解

QString和char以及string之间的赋值详解

如何在二叉树中找出和为某一值的所有路径

精品推荐
分类导航