Exemplo n.º 1
0
void CAddWallTool::NotifyLeftClick( void )
{
	CFVec2 vPos = CMMMContext::GetInstance().GetMouse()->GetPosition();
	if ( m_uNumPoints > 1 && vPos.SquareDistance( m_vSegmentEnds[0] ) < fHANDLE_DIST*fHANDLE_DIST )
	{
		// close the wall segment.
		m_vSegmentEnds[m_uNumPoints++] = m_vSegmentEnds[0];
		CMMMContext::GetInstance().CreateWalls( m_vSegmentEnds, m_uNumPoints/2 );
#pragma warnmsg( "TODO: closed wall segments: fill?" )
		m_uNumPoints = 0;
		return;
	}
	// start the next segment:
	m_vSegmentEnds[m_uNumPoints++] = vPos;
	if ( m_uNumPoints > 1 )
	{
		// and finish the last one:
		m_vSegmentEnds[m_uNumPoints++] = vPos;
	}
}
Exemplo n.º 2
0
void CAddWallTool::Render( void )
{
	if ( 0 == m_uNumPoints )
	{
		return;
	}

	CFVec2 vPos = CMMMContext::GetInstance().GetMouse()->GetPosition();
	m_vSegmentEnds[m_uNumPoints] = vPos;
	if ( vPos.SquareDistance( m_vSegmentEnds[0] ) < fHANDLE_DIST*fHANDLE_DIST )
	{
		// close the wall segment, so show the snap.
		m_vSegmentEnds[m_uNumPoints] = m_vSegmentEnds[0];
	}

	for ( UINT32 i=0; i<m_uNumPoints; i+=2 )
	{
		// draw in red
		CMMMContext::GetInstance().DrawLine( m_vSegmentEnds[i], m_vSegmentEnds[i+1], 0xFFFF0000 );
	}	
}