Пример #1
0
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);
}
Пример #2
0
/**
 *	Simply initialise and kick off the game (application) loop..
 */
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{	
	GDE::CRenderer TheRenderer;
	if ( false == TheRenderer.LoadDLL( g_strDllName ) )
	{
		printf( "Unable to load %s\n", g_strDllName );
		assert_now( "Unable to load %s\n", g_strDllName );
		return 0;
	}
	GDE::CInputDevice TheInput;
	if ( false == TheInput.LoadDLL( g_strDllName ) )
	{
		printf( "Unable to load input from %s\n", g_strDllName );
		assert_now( "Unable to load input from %s\n", g_strDllName );
		return 1;
	}

	GDE::CDataParserManager DataManager;
	if ( false == DataManager.LoadDLL( g_strDllName ) )
	{
		assert_now( "Error loading parsing dll \"%s\"", g_strDllName );
		return -1;
	}

	GDE::CFontManager FontMgr;
	if ( false == FontMgr.LoadDLL( g_strDllName, &TheRenderer ) )
	{
		assert_now( "Error loading font dll \"%s\"", g_strDllName );
		return -1;	
	}


	if ( false == CSteeringContext::GetInstance().Initialise(
			TheRenderer, 
			TheInput, 
			FontMgr,
			DataManager ) )
	{
		assert_now( "Error initialising the steering app" );
		return -1;
	}

	TheRenderer.RunGameLoop();
	CSteeringContext::GetInstance().ReleaseResources();
	return 0;
}
Пример #3
0
/**
 *	Draw the wall. Must show differently if the cat intersects it.
 */
void CWall::Draw( void )
{
	const UINT32 uColour = m_bIntersected?0xFFFF0000:0xFF000000;
	GDE::SVertex Verts[2];
	Verts[0].m_fX = m_vEnd[0].X();
	Verts[0].m_fY = m_vEnd[0].Y();
	Verts[0].m_fZ = 0.5f;
	Verts[0].m_uColour = uColour;

	Verts[1].m_fX = m_vEnd[1].X();
	Verts[1].m_fY = m_vEnd[1].Y();
	Verts[1].m_fZ = 0.5f;
	Verts[1].m_uColour = uColour;
	
	// untextured:
	GDE::CRenderer* pRenderer = CSteeringContext::GetInstance().GetRenderer();
	pRenderer->GetTextureManager().GetNULLTexture()->Apply( 0 );
	pRenderer->DrawPrimitives( GDE::PT_LineList, 1, Verts );
}
Пример #4
0
void
CMole::DrawSteeringForce() const
{
	// Draw line to first target
	GDE::CRenderer* pRenderer = CMMMContext::GetInstance().GetRenderer();


	GDE::SVertex SteerForceLine[2];
	SteerForceLine[0].m_uColour = 0xFF00FF00;
	SteerForceLine[1].m_uColour = 0xFF00FF00;


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

	SteerForceLine[1].m_fX = m_vPosition.X() + (m_vLastSteeringForce.X() * 20.0f);
	SteerForceLine[1].m_fY = m_vPosition.Y() + (m_vLastSteeringForce.Y() * 20.0f);
	SteerForceLine[1].m_fZ = 0.0f;


	pRenderer->DrawPrimitives(GDE::PT_LineList, 1, SteerForceLine);
}
Пример #5
0
void
CMole::DrawTaskPathTarget(CTask& _rTask) const
{
	int iTargetNodeId = _rTask.GetTargetNodeId();
	const std::vector<int>& karNodeIdsPath = _rTask.GetNodeIdsPath();
	GDE::CRenderer* pRenderer = CMMMContext::GetInstance().GetRenderer();


	if (karNodeIdsPath.size() > 0)
	{
		// Draw line to first target
		const CFVec2& kvrNextPosition = s_pSharedPath->GetNode(karNodeIdsPath.back()).vPosition;


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


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

		FirstLine[1].m_fX = kvrNextPosition.X();
		FirstLine[1].m_fY = kvrNextPosition.Y();
		FirstLine[1].m_fZ = 0.0f;


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


		// Draw path lines
		for (int i = karNodeIdsPath.size() - 1; i > 0; -- i)
		{
			const CFVec2& kvrCurrentPosition = s_pSharedPath->GetNode(karNodeIdsPath[i]).vPosition;
			const CFVec2& kvrNextPosition = s_pSharedPath->GetNode(karNodeIdsPath[i - 1]).vPosition;


			GDE::SVertex Vertex[2];
			Vertex[0].m_uColour = 0xFF509999;
			Vertex[1].m_uColour = 0xFF509999;


			Vertex[0].m_fX = kvrCurrentPosition.X();
			Vertex[0].m_fY = kvrCurrentPosition.Y();
			Vertex[0].m_fZ = 0.0f;

			Vertex[1].m_fX = kvrNextPosition.X();
			Vertex[1].m_fY = kvrNextPosition.Y();
			Vertex[1].m_fZ = 0.0f;


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


	if (iTargetNodeId != -1)
	{
		// Draw cross on target
		const Path::TNode& ktrTargetNode = s_pSharedPath->GetNode(iTargetNodeId);


		GDE::SVertex Cross[4];
		Cross[0].m_uColour = 0xFF509999;
		Cross[1].m_uColour = 0xFF509999;
		Cross[2].m_uColour = 0xFF509999;
		Cross[3].m_uColour = 0xFF509999;


		// One
		Cross[0].m_fX = ktrTargetNode.vPosition.X() - 10;
		Cross[0].m_fY = ktrTargetNode.vPosition.Y() - 10;
		Cross[0].m_fZ = 0.0f;

		Cross[1].m_fX = ktrTargetNode.vPosition.X() + 10;
		Cross[1].m_fY = ktrTargetNode.vPosition.Y() + 10;
		Cross[1].m_fZ = 0.0f;


		// Two
		Cross[2].m_fX = ktrTargetNode.vPosition.X() - 10;
		Cross[2].m_fY = ktrTargetNode.vPosition.Y() + 10;
		Cross[2].m_fZ = 0.0f;

		Cross[3].m_fX = ktrTargetNode.vPosition.X() + 10;
		Cross[3].m_fY = ktrTargetNode.vPosition.Y() - 10;
		Cross[3].m_fZ = 0.0f;


		pRenderer->DrawPrimitives(GDE::PT_LineList, 2, Cross);
	}
}