当前位置: 首页>>代码示例>>C++>>正文


C++ CAImageView::runAction方法代码示例

本文整理汇总了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);
}
开发者ID:a752602882,项目名称:DotaMax,代码行数:48,代码来源:UtilManager.cpp


注:本文中的CAImageView::runAction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。