cocos2dx之创建CCControlSlider
来源:互联网 发布:travian 兵工廠 計算法 编辑:程序博客网 时间:2024/06/07 13:00
采用CCControlSlider创建,代码如下:
CCControlSlider *slider = CCControlSlider::create("extensions/sliderTrack.png","extensions/sliderProgress.png" ,"extensions/sliderThumb.png");slider->setAnchorPoint(ccp(0.5, 1.0f));slider->setPosition(ccp(visibleSize.width / 2.0f, visibleSize.height / 2.0f));slider->setMinimumValue(0.1f);slider->setMaximumValue(100.0f);slider->setTag(1);slider->addTargetWithActionForControlEvents(this, cccontrol_selector(HelloWorld::valueChange), CCControlEventValueChanged);this->addChild(slider, 1);
/** Kinds of possible events for the control objects. */enum { CCControlEventTouchDown = 1 << 0, // A touch-down event in the control. CCControlEventTouchDragInside = 1 << 1, // An event where a finger is dragged inside the bounds of the control. CCControlEventTouchDragOutside = 1 << 2, // An event where a finger is dragged just outside the bounds of the control. CCControlEventTouchDragEnter = 1 << 3, // An event where a finger is dragged into the bounds of the control. CCControlEventTouchDragExit = 1 << 4, // An event where a finger is dragged from within a control to outside its bounds. CCControlEventTouchUpInside = 1 << 5, // A touch-up event in the control where the finger is inside the bounds of the control. CCControlEventTouchUpOutside = 1 << 6, // A touch-up event in the control where the finger is outside the bounds of the control. CCControlEventTouchCancel = 1 << 7, // A system event canceling the current touches for the control. CCControlEventValueChanged = 1 << 8 // A touch dragging or otherwise manipulating a control, causing it to emit a series of different values.};
还可以建立色盘,利用CCControlColourPicker,具体代码如下:
void MyControlLayerItem::initLayer() {CCSize size = CCDirector::sharedDirector()->getWinSize();CCControlColourPicker *control = CCControlColourPicker::create();control->setPosition(ccp(size.width / 3.0f, size.height / 3.0f));control->setColor(ccc3(255, 0, 0));control->addTargetWithActionForControlEvents( this, cccontrol_selector(MyControlLayerItem::valueChange), CCControlEventValueChanged);this->addChild(control, 2);}
- cocos2dx之创建CCControlSlider
- cocos2dX UI控件之CCControlSlider
- cocos2dx CCControlSlider
- cocos2dx-CCControlSlider
- cocos2dx CCControlSlider 滑动条
- 和屌丝一起学cocos2dx-CCControlSlider
- cocos2d详细 类之CCControlSlider
- cocos2dx之创建Button
- Cocos2dx之精灵创建
- cocos2dx之创建悬浮节点
- cocos2dx之创建悬浮节点
- Bullet(Cocos2dx)之创建地形
- Bullet(Cocos2dx)之创建地形
- UI开发之控件类-CCControlSlider
- cocos2dx之创建一个菜单按钮
- cocos2dx初接触之创建工程
- cocos2dx之创建有渐影效果的sprite
- cocos2dx之CCAnimate创建一个动画
- xilinx edk入门级(1)
- 空格字符串匹配
- SIGTSTP和SIGSTOP的区别
- 黑马程序员-Java基础-IO总结
- paip.提升性能----数据库连接池以及线程池以及对象池
- cocos2dx之创建CCControlSlider
- 关于集合中理解的问题
- DELPHI中完成端口(IOCP)的简单分析(1)
- java之 数字加密器
- PicSearch
- DELPHI中完成端口(IOCP)的简单分析(2)
- ZendStudio-10.5.0--SN破解工具(最新版)
- hiberate session
- Ubuntu 12.04.3 LTS配置记录