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


C++ rect::mid方法代码示例

本文整理汇总了C++中rect::mid方法的典型用法代码示例。如果您正苦于以下问题:C++ rect::mid方法的具体用法?C++ rect::mid怎么用?C++ rect::mid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在rect的用法示例。


在下文中一共展示了rect::mid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: handle_draw

	void dialog::handle_draw(const rect& r, float rotation, float scale) const
	{
		for(auto& tex : bg_) {
			ASSERT_LOG(tex.is_valid(), "Texture isn't valid.");
		}
		// XXX move all the rect calculations to recalc_dimensions() and store rects.
		// like in the texture.
		
		auto& tl = bg_[static_cast<int>(BackgroundSections::CORNER_TL)];
		tl.blit_ex(rect(r.x(), r.y(), tl.width(), tl.height()) * scale, rotation, r.mid() * scale, graphics::FlipFlags::NONE);
		auto& tr = bg_[static_cast<int>(BackgroundSections::CORNER_TR)];
		tr.blit_ex(rect(r.x2() - tr.width(), r.y(), tr.width(), tr.height()) * scale, rotation, r.mid() * scale, graphics::FlipFlags::NONE);
		auto& bl = bg_[static_cast<int>(BackgroundSections::CORNER_BL)];
		bl.blit_ex(rect(r.x(), r.y2() - bl.height(), bl.width(), bl.height()) * scale, rotation, r.mid() * scale, graphics::FlipFlags::NONE);
		auto& br = bg_[static_cast<int>(BackgroundSections::CORNER_BR)];
		br.blit_ex(rect(r.x2() - br.width(), r.y2() - br.height(), br.width(), br.height()) * scale, rotation, r.mid() * scale, graphics::FlipFlags::NONE);
		auto& cc = bg_[static_cast<int>(BackgroundSections::CENTER)];
		cc.blit_ex(rect(r.x()+tl.width(), r.y()+tl.height(), r.w() - br.width() - tl.width(), r.h() - br.height() - tl.height()) * scale, rotation, r.mid() * scale, graphics::FlipFlags::NONE);
		auto& sl = bg_[static_cast<int>(BackgroundSections::SIDE_LEFT)];
		sl.blit_ex(rect(r.x(), r.y()+tl.height(), tl.width(), r.h()-bl.height()-tl.height()) * scale, rotation, r.mid() * scale, graphics::FlipFlags::NONE);
		auto& sr = bg_[static_cast<int>(BackgroundSections::SIDE_RIGHT)];
		sr.blit_ex(rect(r.x2() - sr.width(), r.y() + tr.height(), sr.width(), r.h()-tr.height()-br.height()) * scale, rotation, r.mid() * scale, graphics::FlipFlags::NONE);
		auto& st = bg_[static_cast<int>(BackgroundSections::SIDE_TOP)];
		st.blit_ex(rect(r.x() + tl.width(), r.y(), r.w() - tl.width() - tr.width(), st.height()) * scale, rotation, r.mid() * scale, graphics::FlipFlags::NONE);
		auto& sb = bg_[static_cast<int>(BackgroundSections::SIDE_BOTTOM)];
		sb.blit_ex(rect(r.x() + br.width(), r.y2() - sb.height(), r.w() - bl.width() - br.width(), sb.height()) * scale, rotation, r.mid() * scale, graphics::FlipFlags::NONE);

		for(auto& w : children_) {
			w->draw(r, rotation, scale);
		}
	}
开发者ID:cbeck88,项目名称:HexWarfare,代码行数:31,代码来源:dialog.cpp


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