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


C++ CCircle::Initialise方法代码示例

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


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

示例1: Draw

void CMole::Draw( void )
{
	m_pSprite->RenderEx( m_vPosition.X(), m_vPosition.Y(), m_fHeading, 1.0f, 1.0f );
	if ( m_bHighlighted )
	{
		CCircle Bounds;
		Bounds.Initialise( m_vPosition, fMOLE_RADIUS );
		CMMMContext::GetInstance().DrawCircle( Bounds, 0xFFFF0000 );
	}

#ifndef _EDITOR
	if (CMMMContext::GetInstance().IsDrawingMoleState())
	{
		CCircle radiusCircle;
		radiusCircle.Initialise(m_vPosition, fMOLE_RADIUS);
		CMMMContext::GetInstance().DrawCircle(radiusCircle, 0xFF00FF00);

		CCircle destinationCircle;
		destinationCircle.Initialise(m_vDestination, 5.0f );
		CMMMContext::GetInstance().DrawCircle(destinationCircle, 0xFF8800FF);
	}

	m_pMoleAgent->Draw();
#endif
}
开发者ID:roosen5,项目名称:media-design-school,代码行数:25,代码来源:Mole.cpp

示例2:

void		CSquirrel::LoseLife( void )
{
	if ( m_uNumLives )
	{
		// do not lose a life if over a tunnel:
		CTunnel*	pTunnels;
		UINT32		uNumTunnels;
		CMMMContext::GetInstance().GetTunnels( pTunnels, uNumTunnels );

		CCircle Bounds;
		Bounds.Initialise( m_vPosition, m_fRadius );
		for ( UINT32 i=0; i<uNumTunnels; i++ )
		{
			if ( pTunnels[i].Intersects( Bounds ) )
			{
				return; // immune, over a tunnel!
			}
		}


		for ( UINT32 i=0; i<m_uNumAcorns; i++ )
		{
			m_ppAcorns[i]->SetState( CAcorn::ES_Available );
		}
		m_uNumAcorns = 0;
		m_uNumLives--;
		if ( m_uNumLives )
		{
			Spawn();
		} else
		{
			CMMMContext::GetInstance().NotifySquirrelDeath();
		}
	}
}
开发者ID:roosen5,项目名称:media-design-school,代码行数:35,代码来源:Squirrel.cpp

示例3:

void
CMole::DrawTargetAcorn(const CAcorn* _kpAcorn) const
{
	GDE::CRenderer* pRenderer = CMMMContext::GetInstance().GetRenderer();


	GDE::SVertex FirstLine[2];
	FirstLine[0].m_uColour = 0xFFFFFF00;
	FirstLine[1].m_uColour = 0xFFFFFF00;


	FirstLine[0].m_fX = m_vPosition.X();
	FirstLine[0].m_fY = m_vPosition.Y();
	FirstLine[0].m_fZ = 0.0f;

	FirstLine[1].m_fX = _kpAcorn->GetPosition().X();
	FirstLine[1].m_fY = _kpAcorn->GetPosition().Y();
	FirstLine[1].m_fZ = 0.0f;


	pRenderer->DrawPrimitives(GDE::PT_LineList, 1, FirstLine);

	CCircle AcornCircle;
	AcornCircle.Initialise(_kpAcorn->GetPosition(), 14.0f);


	AcornCircle.Draw(0xAAFFFF00, true);
}
开发者ID:bullfrognz,项目名称:MoleMadness,代码行数:28,代码来源:Mole.cpp

示例4: Update

void CMole::Update(FLOAT32 _fTimeDelta)
{
	m_pMoleAgent->Update(_fTimeDelta);

	// Turn.
	m_fHeading += m_pMoleAgent->GetRotationalSpeed() * _fTimeDelta;

	// Update position.
	CFVec2 vHeading;
	vHeading.SetToRotationZ(m_fHeading);
	CFVec2 vVelocity = vHeading * m_pMoleAgent->GetSpeed() * _fTimeDelta;
	m_vPosition += vVelocity;

	if ((m_vDestination - m_vPosition).Magnitude() < fMOLE_RADIUS)
	{
		Messages::send(DESTINATION_REACHED_EVENT, this);
	}

	// finally check if that pesky rodent got caught:
	CCircle Bounds;
	Bounds.Initialise( m_vPosition, fMOLE_RADIUS );
	if ( CMMMContext::GetInstance().GetSquirrel()->Intersects( Bounds ) )
	{
		CMMMContext::GetInstance().GetSquirrel()->LoseLife();
		Messages::send(DESTINATION_REACHED_EVENT, this);
	}
}
开发者ID:roosen5,项目名称:media-design-school,代码行数:27,代码来源:Mole.cpp

示例5: Draw

void CPathFindingAgent::Draw() const
{
	if (m_path.size() > 1)
	{
		for (UINT32 uiIndex = 0; uiIndex < m_path.size() - 1; uiIndex++)
		{
			CCircle waypointCircle;
			waypointCircle.Initialise(m_path[uiIndex]->GetPosition(), 5.0f);
			CMMMContext::GetInstance().DrawCircle(waypointCircle, 0xFFBFBD2B);
			CMMMContext::GetInstance().DrawLine(m_path[uiIndex]->GetPosition(), m_path[uiIndex + 1]->GetPosition(), 0xFFBFBD2B);
		}
		
		CCircle waypointCircle;
		waypointCircle.Initialise(m_path.back()->GetPosition(), 5.0f);
		CMMMContext::GetInstance().DrawCircle(waypointCircle, 0xFFBFBD2B);
		
		CCircle destinationCircle;
		destinationCircle.Initialise(m_vDestination, fGRID_SIZE);
		CMMMContext::GetInstance().DrawCircle(destinationCircle, 0xFFBFBD2B);
	}
}
开发者ID:roosen5,项目名称:media-design-school,代码行数:21,代码来源:PathFindingAgent.cpp

示例6: Draw

/**
 *	Draw the board.
 *	Should be properly decoupled, oops.
 */
void CGameBoard::Draw( void )
{
	CCircle Circle;
	UINT32 colCurrent;

	bool bHighlighted = false;

	for ( int y=0; y<m_iHeight; y++ )
	{
		for ( int x=0; x<m_iWidth; x++ )
		{
			switch( GetBoardPos( x, y ) )
			{
			default:
			case BOARD_ERROR:
				assert_now( "Error with board" );
			case EMPTY:
				colCurrent = colEMPTY;
				break;
			case PLAYER1:
				colCurrent = colPLAYER_ONE;
				break;
			case PLAYER2:
				colCurrent = colPLAYER_TWO;
				break;
			}
			const FLOAT32 fXPos = fPIECE_RADIUS+fPIECE_SPACING+(fPIECE_SPACING + fPIECE_RADIUS*2)*x;
			const FLOAT32 fYPos = fPIECE_RADIUS+fPIECE_SPACING+(fPIECE_SPACING + fPIECE_RADIUS*2)*y;
			Circle.Initialise( SFVec2( fXPos, fYPos ), fPIECE_RADIUS );
			CConnect4Context::GetInstance().DrawFilledCircle( Circle, colCurrent );
			if ( false == bHighlighted )
			{
				if ( m_iColumnHighlighted == x )
				{
					CConnect4Context::GetInstance().DrawCircle( Circle, colHIGHLIGHT );			
				}
			}
		}
	}
}
开发者ID:roosen5,项目名称:media-design-school,代码行数:44,代码来源:GameBoard.cpp

示例7: Intersects

bool CSquirrel::Intersects( const CCircle& Circle ) const
{
	CCircle Bounds;
	Bounds.Initialise( m_vPosition, m_fRadius );
	return Circle.Overlaps( Bounds );
}
开发者ID:roosen5,项目名称:media-design-school,代码行数:6,代码来源:Squirrel.cpp

示例8: vHeading

void
CMole::UpdatePosition(float _fTimeDelta)
{
	CCircle SelfCircle;
	CWall* pWalls = 0;
	CAcorn* pAcorns = 0;
	CMole* pMoles = 0;
	int iNumWalls = 0;
	int iNumAcorns = 0;
	int iNumMoles = 0;
	bool bCollision = false;


	// Create heading vector
	CFVec2 vHeading(0.0f, -1.0f);
	vHeading.RotateZ(m_fHeading);


	float fMovementVelocity = m_fMovementVelocity + (DIFFICULTY_MOVEMENT_VELOCITY_INCR * m_iDifficultyLevel);


	CFVec2 vNextPosition = m_vPosition;
	vNextPosition += vHeading * (fMovementVelocity * _fTimeDelta);


	SelfCircle.Initialise(vNextPosition, m_fRadius);


	CMMMContext& rMMMContext = CMMMContext::GetInstance();
	rMMMContext.GetWalls(pWalls, iNumWalls);
	rMMMContext.GetAcorns(pAcorns, iNumAcorns);
	rMMMContext.GetMoles(pMoles, iNumMoles);

	

	CCircle EntityCircle;
	SelfCircle.Initialise(vNextPosition, m_fRadius);


	// Check collision against other moles
	for (int i = 0; i < iNumMoles; ++ i)
	{
		if (&pMoles[i] != this)
		{
			EntityCircle.Initialise(pMoles[i].GetPosition(), pMoles[i].GetRadius());


			if (SelfCircle.Overlaps(EntityCircle))
			{
				bCollision = true;
				break;
			}
			else
			{
				// Do nothing
			}
		}
	}


	if (!bCollision)
	{
		// Check collision against walls
		for (int i = 0; i < iNumWalls; ++ i)
		{
			if (SelfCircle.OverlapsLineSegment(pWalls[i].GetEnd0(), pWalls[i].GetEnd1()))
			{
				bCollision = true;


				break;
			}
		}
	}


	if (!bCollision)
	{
		m_vPosition = vNextPosition;
	}
}
开发者ID:bullfrognz,项目名称:MoleMadness,代码行数:81,代码来源:Mole.cpp

示例9: Intersects

bool CMole::Intersects( const CBox2D& Box ) const
{
	CCircle Bounds;
	Bounds.Initialise( m_vPosition, fMOLE_RADIUS );
	return Box.Intersects( Bounds );
}
开发者ID:roosen5,项目名称:media-design-school,代码行数:6,代码来源:Mole.cpp


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