void Block::Draw(long posX, long posY, App &app, TextureContainer &tC, unsigned short metadata)
{
	sf::Sprite *&&tempSprite = &(tC.getTextures(getTextureName())[getTextureId(app, metadata)]);
	if (tempSprite != nullptr)
	{
		tempSprite->setPosition(posX, posY);
		app.draw(*tempSprite);
	}
}
Exemple #2
0
void Creature::Draw(sf::RenderWindow &app, TextureContainer &tc)
{
	sf::Sprite *sprite = &(tc.getTextures(spriteName)[spriteIndex]);
	if (sprite != NULL)
	{
		sprite->SetPosition(sf::Vector2f(x, y));
		sprite->SetRotation(angle);
		app.Draw(*sprite);
	}
	else
	{
		std::cout << "'" << getTextureName() << "' not found!" << std::endl;
	}
}
void Inventory::Draw(int xPos, int yPos, App& app, TextureContainer& tC)
{
	int x = xPos;
	int y = yPos;
	int slot = 0;
	sf::Sprite slotSprite = tC.getTextures("slot.png")[0];
	for(int xSlot = 0; xSlot < xSize; xSlot++)
	{
		for(int ySlot = 0; ySlot < ySize; ySlot++)
		{
			slotSprite.setPosition(x + (xSlot * 32), y + (ySlot * 32));
			app.draw(slotSprite);
			slot++;
		}
	}
}