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


C++ COperator::GetLayerHot方法代码示例

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


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

示例1: OnEvent

void CToolSetTileHeight::OnEvent(ip::CInputDevice::SEvent & event)
{	
	COperator * pOperator = CXFile::GetInstance()->GetOperator();
	CTerrainMesh * pTerrainMesh = CXFile::GetInstance()->GetTerrainMesh();

	switch ( event.eType )
	{
	case ip::EIET_KB_KEYUP:
		{
			// shrink brush
			if ( event.dwData == DIK_MINUS )
			{
				if ( pOperator->GetBrushSize() > 1 ) pOperator->DecBrushSize();
			}
			
			// amplify brush
			if ( event.dwData == DIK_EQUALS )
			{
				pOperator->IncBrushSize();
			}
			
			//switch(event.dwData)
			//{
			//case DIK_3:
			//	{
			//		pOperator->SetHeightType((COperator::ESET_HEIGHT_TYPE)((pOperator->GetHeightType() + 1) % pOperator->GetHeightTypeCount()));
			//	}
			//break;

			//case DIK_4:
			//	{
			//		pOperator->SetAxisType((COperator::EAXIS_TYPE)((pOperator->GetAxisType() + 1) % pOperator->GetAxisTypeCount()));
			//	}
			//break;

			//case DIK_5:
			//	{
			//		pOperator->SetWayType((COperator::ESET_WAY_TYPE)((pOperator->GetWayType() + 1) % pOperator->GetWayTypeCount()));
			//	}
			//break;
			//}
		}
	break;
	
	case ip::EIET_MS_BTNUP :
	case ip::EIET_MS_MOVE :	
		{
			if ( ip::CInputDevice::GetInstance()->GetButtonState(MK_LBUTTON) )
			{
				DWORD dwTextureHandleHot = pOperator->GetTextureHandleHot();
				DWORD dwLayerHot = pOperator->GetLayerHot();
	
				CCmdSetVertexHeight * pCmd = new CCmdSetVertexHeight;
				
				// set grids via brush size
				if ( pOperator->GetGridIndexHot() != INVALID )
				{
					DWORD dwCnt = 4*pOperator->GetBrushSize()*pOperator->GetBrushSize();
					
					DWORD dwGridIndex = pOperator->GetGridIndexHot() - pOperator->GetBrushSize() - pOperator->GetBrushSize() * pTerrainMesh->GetWidth();
	
					for ( DWORD j = 0; j < dwCnt; j++)
					{
						if ( j )
						{
							if ( !(j % (2 * pOperator->GetBrushSize())) ) 
								dwGridIndex += pTerrainMesh->GetWidth() - 2*pOperator->GetBrushSize() + 1;
							else
								++dwGridIndex;
						}

						// check for valid grid
						if ( dwGridIndex < 0 || dwGridIndex > pTerrainMesh->GetDepth() * pTerrainMesh->GetWidth() )
						{
							continue;
						}

						CTerrainMesh::SGrid & grid = pTerrainMesh->GetGrid(dwGridIndex);

						for ( int i = 0; i < 4; i++)
						{
							pCmd->AddVertex(grid.dwVertexIndex[i]);
						}
					}
				}

				CCmdMgr::GetInstance()->Do(pCmd);
			}
		}
		break;
	}
}
开发者ID:LaoZhongGu,项目名称:RushGame,代码行数:92,代码来源:ToolSetTileHeight.cpp


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