Exemplo n.º 1
0
void Game::paint()
{	

	//While the game is loading, the load method will be called once per update
	if (isLoading() == true)
	{
		//Cache the screen width and height
		float screenWidth = getScreenWidth();
		float screenHeight = getScreenHeight();

		//Draw a black background, you could replace this
		//in the future with a full screen background texture
		OpenGLRenderer::getInstance()->setForegroundColor(OpenGLColorBlack());
		OpenGLRenderer::getInstance()->drawRectangle(0.0f, 0.0f, screenWidth, screenHeight);

		//Calculate the bar width and height, don't actually hard-code these
		float barWidth = 200.0f * getScale();
		float barHeight = 40.0f * getScale();
		float barX = (screenWidth - barWidth) / 2.0f;
		float barY = (screenHeight - barHeight) / 2.0f;

		//
		float percentageLoaded = (float)m_LoadStep / (float)(GameLoadStepCount - 1);
		float loadedWidth = barWidth * percentageLoaded;
		OpenGLRenderer::getInstance()->setForegroundColor(OpenGLColorYellow());
		OpenGLRenderer::getInstance()->drawRectangle(barX, barY, loadedWidth, barHeight);

		//
		OpenGLRenderer::getInstance()->setForegroundColor(OpenGLColorWhite());
		OpenGLRenderer::getInstance()->drawRectangle(barX, barY, barWidth, barHeight, false);

		return;
	}

	OpenGLRenderer::getInstance()->drawTexture(m_BackgroundTexture,0.0f,0.0f);

#if _DEBUG
	if (m_World != NULL)
	{
		m_World->DrawDebugData();
	}
#endif

	//Paint the game's game objects
	for (int i = 0; i < m_GameObjects.size(); i++)
	{
		m_GameObjects.at(i)->paint();
	}
}
void PathFinder::paint()
{
    //Paint the open list path scoring
    for(int i = 0; i < m_PathNodeOpen.size(); i++)
    {
        m_PathNodeOpen.at(i)->paintScore(OpenGLColorRed());
    }

    //Paint the closed list path scoring
    for(int i = 0; i < m_PathNodeClosed.size(); i++)
    {
        m_PathNodeClosed.at(i)->paintScore(OpenGLColorBlue());
    }

    //Paint the final path scoring
    for(int i = 0; i < m_PathNodeFinal.size(); i++)
    {
        m_PathNodeFinal.at(i)->paintScore(OpenGLColorYellow());
    }
}
void PathFinder::paint()
{
    //Paint the tile scoring for all the path nodes in the closed list.
    for(int i = 0; i < m_ClosedList.size(); i++)
    {
        m_ClosedList.at(i)->paintScoring(OpenGLColorBlue());
    }
    
    //Paint the tile scoring for all the path nodes in the closed list.
    for(int i = 0; i < m_OpenList.size(); i++)
    {
        m_OpenList.at(i)->paintScoring(OpenGLColorRed());
    }
    
    //Paint the tile scoring for all the path nodes in the closed list.
    for(int i = 0; i < m_FinalPath.size(); i++)
    {
        m_FinalPath.at(i)->paintScoring(OpenGLColorYellow());
    }
}