手机
当前位置:查字典教程网 >编程开发 >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控件类使用实例】相关文章:

STL常用容器详细解析

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

C++多继承同名隐藏实例详细介绍

C++中引用的使用总结

c语言:基于函数指针的两个示例分析

c++中#include <>与#include""的区别详细解析

wchar_t,char,string,wstring之间的相互转换

linux之sed命令的用法

基于C++ list中erase与remove函数的使用详解

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

精品推荐
分类导航