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


C++ Corner::get_altitude方法代码示例

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


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

示例1: draw_map


//.........这里部分代码省略.........
	// ##### end Gilbert 2/11 #####//
	case MAP_MODE_SPOT:
		{	// traversal of location in MapMatrix
			int pixelX = (image_x1 + image_x2 + 1) / 2;
			int pixelY = image_y1;
			int xLoc, yLoc;
			int writePtrInc = vga_back.buf_pitch() + 1;
			for( yLoc = 0; yLoc < max_y_loc; (yLoc&1?++pixelY:--pixelX) , ++yLoc )
			{
				short* writePtr  = vga_back.buf_ptr(pixelX, pixelY);
				xLoc = 0;
				Location* locPtr = get_loc( xLoc, yLoc );
				for( ; xLoc < max_x_loc; (xLoc += 2), (locPtr +=2), (writePtr += writePtrInc) )
				{
					if( locPtr->explored() )
					{
						*writePtr = mapModeColor;
					}
				}
			}
		}
		break;

	case MAP_MODE_POWER:
		{
			int pixelX = (image_x1 + image_x2 + 1) / 2;
			int pixelY = image_y1;
			int xLoc, yLoc;
			int writePtrInc = vga_back.buf_pitch() + 1;
			for( yLoc = 0; yLoc < max_y_loc; (yLoc&1?++pixelY:--pixelX) , ++yLoc )
			{
				short* writePtr  = vga_back.buf_ptr(pixelX, pixelY);
				xLoc = 0;
				Location *locPtr = get_loc( xLoc, yLoc );
				for( xLoc = 0; xLoc < max_x_loc; (xLoc += 2), (locPtr +=2), (writePtr += writePtrInc) )
				{
					if( locPtr->explored() )
					{
						// ####### begin Gilbert 10/2 #########//
						if( filter_object_flag || filter_nation_flag )		// do not anything except filtered objects when filters are on
							*writePtr = mapModeColor;
						else if( locPtr->sailable() )
						// ####### end Gilbert 10/2 #########//
							*writePtr = seaColor;
						else if( locPtr->is_rock() || locPtr[1].is_rock() )
							*writePtr = rockColor;
/*						else if( locPtr->has_dirt() )
						{
							Rock *dirtPtr = dirt_array[locPtr->dirt_recno()];
							RockInfo *dirtInfo = rock_res.get_rock_info(dirtPtr->rock_recno);
							if (dirtInfo->rock_type == 'P')
								*writePtr = seaColor;
							else
								*writePtr = rockColor;
						}

						else if( locPtr->is_plant() || xLoc+1<max_x_loc && locPtr[1].is_plant() )
							*writePtr = plantColor;
*/						else
						// ###### begin Gilbert 21/12 ########//
						{
							if( power_mode )
								*writePtr = nationColorArray[locPtr->power_nation_recno];
							else
								*writePtr = nationColorArray[0];
						}
						// ###### end Gilbert 21/12 ########//
					}
				}
			}
		}
		break;

	case MAP_MODE_ALTITUDE:
		{
			int pixelX = (image_x1 + image_x2 + 1) / 2;
			int pixelY = image_y1;
			int xLoc, yLoc;
			int writePtrInc = vga_back.buf_pitch() + 1;
			for( yLoc = 0; yLoc < max_y_loc; (yLoc&1?++pixelY:--pixelX) , ++yLoc )
			{
				short* writePtr  = vga_back.buf_ptr(pixelX, pixelY);
				xLoc = 0;
				for( xLoc = 0; xLoc < max_x_loc; (xLoc += 2), (writePtr += writePtrInc) )
				{
					Corner *cornerPtr = get_corner( xLoc, yLoc );
					short alt = cornerPtr->get_altitude();
					if( alt > 255 )
						alt = 255;
					else if( alt < 0 )
						alt = 0;
					*writePtr = vga.make_pixel((BYTE)alt, 128, 32);
				}
			}
		}
		break;
	}

	sys.yield();
}
开发者ID:112212,项目名称:7k2,代码行数:101,代码来源:oworld_m.cpp


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