UIRadioButton公有属性、方法
/**
* 状态类型
*/
enum class EventType
{
SELECTED,
UNSELECTED
};
/**
* UIRadioButton回调
*/
typedef std::function<void(RadioButton* radioButton, EventType)> ccRadioButtonCallback;
/**
* 创建一个RadioButton实例
* @param backGround 默认状态下的背景图片
* @param backGroundSelected 选中状态下的背景图片
* @param cross 选中状态下的勾选图片
* @param backGroundDisabled 禁用状态下的背景图片
* @param frontCrossDisabled 禁用状态下的勾选图片
* @param texType 图片类型(Local、Plist)
* @return RadioButton实例
*/
static RadioButton* create(const std::string& backGround,
const std::string& backGroundSelected,
const std::string& cross,
const std::string& backGroundDisabled,
const std::string& frontCrossDisabled,
TextureResType texType = TextureResType::LOCAL);
/**
* 创建一个RadioButton实例
* @param backGround 默认状态下的背景图片
* @param cross 选中状态下的勾选图片
* @param texType 图片类型(Local、Plist)
* @return RadioButton实例
*/
static RadioButton* create(const std::string& backGround,
const std::string& cross,
TextureResType texType = TextureResType::LOCAL);
/**
* 交互事件回调
*/
void addEventListener(const ccRadioButtonCallback& callback);
UIRadioButton 示例
var radio_uncheck = "btn_radio_uncheck.png";
var radio_check = "btn_radio_check.png";
var radio_croo = "btn_minus.png";
var node = new ccui.RadioButton(radio_uncheck, radio_check, radio_croo, radio_check, radio_check, ccui.Widget.PLIST_TEXTURE);
node.setAnchorPoint(0, 0);
node.setPosition(640, 360);
this.addChild(node);