本文整理汇总了C++中CAImageView::runAction方法的典型用法代码示例。如果您正苦于以下问题:C++ CAImageView::runAction方法的具体用法?C++ CAImageView::runAction怎么用?C++ CAImageView::runAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAImageView
的用法示例。
在下文中一共展示了CAImageView::runAction方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: toast
void UtilManager::toast(string text, string image, bool isSmall) {
CAApplication::getApplication()->getRootWindow()->removeSubviewByTag(TOAST_VIEW_TAG);
CCSize winSize = CAApplication::getApplication()->getWinSize();
CAImageView *back = CAImageView::create();
if (isSmall == false) {
//CAView *back = CAView::createWithCenter(CCRect(winSize.width*0.5, winSize.height*0.5, _dip(winSize.width)*0.3, _dip(winSize.height)*0.3));
back->setCenter(CCRect(winSize.width*0.5, winSize.height*0.55, _px(120), _px(120)));
}
else {
back->setCenter(CCRect(winSize.width*0.5, winSize.height*0.4, _px(120), _px(120)));
}
back->setTag(TOAST_VIEW_TAG);
back->setImage(CAImage::create("image/scape_storage.png"));
//back->setColor(ccc4(31, 31, 31, 200));//40
CALabel *title = CALabel::createWithCenter(CADipRect(_dip(back->getBounds().size.width*0.5),
_dip(back->getBounds().size.height*0.8), 100, 100));
//title->setText(UTF8ToGBK::transferToGbk(text));
//title->setFontName(getChineseFont());
title->setColor(CAColor_white);
title->setTextAlignment(CATextAlignmentCenter);
title->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
title->setFontSize(_px(22));
back->addSubview(title);
CAImageView *icon = CAImageView::create();
if (isSmall == false) {
//CAView *back = CAView::createWithCenter(CCRect(winSize.width*0.5, winSize.height*0.5, _dip(winSize.width)*0.3, _dip(winSize.height)*0.3));
icon->setCenter(CADipRect(_dip(back->getBounds().size.width*0.5), _dip(back->getBounds().size.height*0.4), 90 / 1.5, 68 / 1.5));
}
else {
icon->setCenter(CADipRect(_dip(back->getBounds().size.width*0.5), _dip(back->getBounds().size.height*0.4), 72 / 1.5, 72 / 1.5));
}
//CAImageView *icon = CAImageView::createWithCenter(CADipRect(_dip(back->getBounds().size.width*0.5),_dip(back->getBounds().size.height*0.4), 105/1.5, 95/1.5));
icon->setImage(CAImage::create(image));
back->addSubview(icon);
CAApplication::getApplication()->getRootWindow()->addSubview(back);
//CCLog("%s", get_date_now().c_str());
icon->runAction(CCSequence::createWithTwoActions(CCDelayTime::create(0.3), CCFadeOut::create(TOAST_TIME / 2.0)));
back->runAction(CCSequence::createWithTwoActions(CCDelayTime::create(0.3), CCFadeOut::create(TOAST_TIME)));
scheduleOnce(schedule_selector(UtilManager::removeToast), this, TOAST_TIME);
}