手机
当前位置:查字典教程网 >编程开发 >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语言宏定义使用分析

Qt之ui在程序中的使用-多继承法介绍

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

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

指针与const限定符的使用分析

C++按位异或运算符的使用介绍

关于C语言指针赋值的问题详解

C++中引用的使用总结

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

STL各个容器性能详细比较

精品推荐
分类导航