Пример #1
0
/*
	addSpriteItemsToRenderList - This method goes through all of the sprites,
	including the player sprite, and adds the visible ones to the render list.
	This method should be called each frame.
*/
void SpriteManager::addSpriteItemsToRenderList()
{
	Game *game = Game::getSingleton();
	GameStateManager *gsm = game->getGSM();
	GameGUI *gui = game->getGUI();
	if (gsm->isWorldRenderable())
	{
		GameGraphics *graphics = game->getGraphics();
		RenderList *renderList = graphics->getWorldRenderList();
		Viewport *viewport = gui->getViewport();

		// ADD THE PLAYER SPRITE, IF THERE IS ONE
		if (player != nullptr)
			addSpriteToRenderList(player, renderList, viewport);

		// NOW ADD THE REST OF THE SPRITES
		list<Bot*>::iterator botIterator;
		botIterator = bots.begin();
		while (botIterator != bots.end())
		{			
			Bot *bot = (*botIterator);
			addSpriteToRenderList(bot, renderList, viewport);
			botIterator++;
		}
	}
}
Пример #2
0
/*
	addWorldRenderItemsToRenderList - This method sends the render
	list and viewport to each of the layers such that they
	may fill it with RenderItems to draw.
*/
void World::addWorldRenderItemsToRenderList(Game *game)
{
	GameStateManager *gsm = game->getGSM();
	GameGUI *gui = game->getGUI();
	if (gsm->isWorldRenderable())
	{
		GameGraphics *graphics = game->getGraphics();
		RenderList *renderList = graphics->getWorldRenderList();
		Viewport *viewport = gui->getViewport();
		for (unsigned int i = 0; i < layers->size(); i++)
		{
			layers->at(i)->addRenderItemsToRenderList(	renderList,
														viewport);
		}
	}
}
Пример #3
0
/*
	addSpriteItemsToRenderList - This method goes through all of the sprites,
	including the player sprite, and adds the visible ones to the render list.
	This method should be called each frame.
*/
void SpriteManager::addSpriteItemsToRenderList(	Game *game)
{
	GameStateManager *gsm = game->getGSM();
	GameGUI *gui = game->getGUI();
	if (gsm->isWorldRenderable())
	{
		GameGraphics *graphics = game->getGraphics();
		RenderList *renderList = graphics->getWorldRenderList();
		Viewport *viewport = gui->getViewport();

		// ADD THE PLAYER SPRITE
		addSpriteToRenderList(&player, renderList, viewport);


		// NOW ADD THE REST OF THE SPRITES
		list<AnimatedSprite*>::iterator botIterator;
		botIterator = enemies.begin();
		while (botIterator != enemies.end())
		{			
			AnimatedSprite *bot = (*botIterator);
			addSpriteToRenderList(bot, renderList, viewport);
			botIterator++;
		}

		// NOW ADD THE REST OF THE SPRITES
		list<AnimatedSprite*>::iterator blockIterator;
		blockIterator = blocks.begin();
		while (blockIterator != blocks.end())
		{
			AnimatedSprite *block = (*blockIterator);
			addSpriteToRenderList(block, renderList, viewport);
			blockIterator++;
		}

		list<AnimatedSprite*>::iterator exitIt;
		exitIt = exits.begin();
		while (exitIt != exits.end())
		{
			AnimatedSprite *exit = (*exitIt);
			addSpriteToRenderList(exit, renderList, viewport);
			exitIt++;
		}
	}
}
/*
	addSpriteItemsToRenderList - This method goes through all of the sprites,
	including the player sprite, and adds the visible ones to the render list.
	This method should be called each frame.
*/
void SpriteManager::addSpriteItemsToRenderList(	Game *game)
{
	GameStateManager *gsm = game->getGSM();
	GameGUI *gui = game->getGUI();
	if (gsm->isWorldRenderable())
	{
		GameGraphics *graphics = game->getGraphics();
		RenderList *renderList = graphics->getWorldRenderList();
		Viewport *viewport = gui->getViewport();

		// ADD THE PLAYER SPRITE
		addSpriteToRenderList(&player, renderList, viewport);
	/*	X = player.getPhysicalProperties() -> getX();
		Y = player.getPhysicalProperties() -> getY();*/
		//addSpriteToRenderList(&healthBar, renderList, viewport);
		// NOW ADD THE REST OF THE SPRITES
		list<Bot*>::iterator botIterator;
		botIterator = bots.begin();
		while (botIterator != bots.end())
		{			

			Bot *bot = (*botIterator);
			if (bot->getCurrentState() == L"DYING" && bot->getRemoval() > 0)
				bot->setRemoval(bot->getRemoval()-1);
			if (bot->getRemoval() != 0) {
				addSpriteToRenderList(bot, renderList, viewport);
			}
			
			if (bot->getRemoval() == 0){
					
					
				//bot->setCurrentlyCollidable(false);	
			}
			
			botIterator++;
		}
	}
}