继承关系
api文档地址:http://cn.cocos2d-x.org/doc/cocos2d-x-3.0/da/d32/classcocos2d_1_1extension_1_1_control.html
#include <CCControl.h>
类 Control 继承关系图:
ControlSwitch:开关控件
ControlSlider:滑块控件
ControlButton:状态按钮控件
ControlSwitch
开关控件示例代码(基于Cocos2d-x2.1.5):
ControlSlider
可拖动控件示例代码(基于Cocos2d-x2.1.5):
ControlButton
可监听按钮的各种状态:
1.CCControlEventTouchDown 按钮按下
2.CCControlEventTouchDragInside 按下,在按钮内拖曳
3.CCControlEventTouchDragOutside 按下,在按钮外拖曳
4.CCControlEventTouchDragEnter 按下按钮,手指移入按钮内时触发
5.CCControlEventTouchDragExit 按下按钮,手指移出按钮外时触发
6.CCControlEventTouchUpInside 手指在按钮中抬起
7.CCControlEventTouchUpOutside 手指在按钮外抬起
8.CCControlEventTouchCancel 取消触摸