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


C++ Cam::GetCameraWidth方法代码示例

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


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

示例1:

int	Map_Drawable::RefreshToSurface(ID::Surface* s,
				       int x, int y)
{
	Game*					g;
	Cam*					c;
	Map*					m;
	Light_Drawable*				cases;
	uint32_t				i;
//	uint32_t				indexSaver;
	uint32_t				tmpSaver;
	std::list<Unit*>::iterator		itU;
	std::list<Unit*>::iterator		endU;
	int					xMin;
	int					yMin;
	int					xMax;
	int					yMax;
	int					offsetCamX;
	int					offsetCamY;
	ID::Draw_Geometry_Circle*		focus;
	double					xU;
	double					yU;
	bool					selected;

	g = Game::GetInstance();
	c = Cam::GetInstance();
	m = Map::GetInstance();
	focus = ID::Draw_Geometry_Circle::GetInstance();

	if (this->__RefreshGrounds(UNDER_BACKGROUND, ON_BACKGROUND, s, x, y) == -1)
		return -1;

	cases = c->GetCases();
	offsetCamX = c->GetOffsetX();
	offsetCamY = c->GetOffsetY();
	xMax = c->GetCameraWidth() / CASE_SIDE_PIXELS;
	yMax = c->GetCameraHeight() / CASE_SIDE_PIXELS;
//	indexSaver = ((c->GetY() / CASE_SIDE_PIXELS) -
//		      (c->GetCameraHeightRayon() / CASE_SIDE_PIXELS)) *
//		     (c->GetMapWidth() / CASE_SIDE_PIXELS) +
//		     (c->GetX() / CASE_SIDE_PIXELS - c->GetCameraWidthRayon() / CASE_SIDE_PIXELS);
	tmpSaver = g->currentTick;
	yMin = 0;
	while (yMin < yMax)
	{
		xMin = 0;
		i = ((yMin + (c->GetOffsetY() / CASE_SIDE_PIXELS)) *
		     (c->GetMapWidth() / CASE_SIDE_PIXELS)) +
		    (c->GetOffsetX() / CASE_SIDE_PIXELS);
		while (xMin < xMax)
		{
			itU = m->cases[i].units.begin();
			endU = m->cases[i].units.end();
			while (itU != endU)
			{
				if (((*itU)->GetModel()->GetType() == TYPE_GROUND ||
				     (*itU)->GetModel()->GetType() == 3) &&
				    (*itU)->GetUpdateSaver() != tmpSaver)
				{
					(*itU)->SetUpdateSaver(tmpSaver);
					(*itU)->GetPositionXY(&xU, &yU);
					selected = (*itU)->GetTickSelection() == g->lastSelection;
					focus->Draw(s,
						    xU * CASE_SIDE_PIXELS - offsetCamX,
						    yU * CASE_SIDE_PIXELS - offsetCamY,
						    (*itU)->GetModel()->GetSize(),
						    selected,
						    &(m->_colorsPalette[(*itU)->GetPlayer()->GetID()]));
				}
				++itU;
			}
			++xMin;
			++i;
		}
		++yMin;
	}

	if (this->__RefreshGrounds(MIDDLEGROUND, MIDDLEGROUND, s, x, y) == -1)
		return -1;

	tmpSaver = g->currentTick + 1;
//	i = indexSaver;
	yMin = 0;
//	std::cout << "- - - - - - - - \n";
	while (yMin < yMax)
	{
		xMin = 0;
		i = ((yMin + (c->GetOffsetY() / CASE_SIDE_PIXELS)) *
		     (c->GetMapWidth() / CASE_SIDE_PIXELS)) +
		    (c->GetOffsetX() / CASE_SIDE_PIXELS);
		while (xMin < xMax)
		{
			itU = m->cases[i].units.begin();
			endU = m->cases[i].units.end();
//			std::cout << i << "	";
			while (itU != endU)
			{
				if (((*itU)->GetModel()->GetType() == TYPE_AIR ||
				     (*itU)->GetModel()->GetType() == 4) &&
				    (*itU)->GetUpdateSaver() != tmpSaver)
				{
//.........这里部分代码省略.........
开发者ID:antoinechene,项目名称:RTS-SDL,代码行数:101,代码来源:Map_Drawable.cpp


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