コード例 #1
0
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);
	}
}
コード例 #2
0
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++;
		}
	}
}
コード例 #3
0
	void Button::Draw(App &app, float drawAreax, float drawAreay, int drawAreaWidth, int drawAreaHeight)
	{
		// define a 120x50 rectangle
		/*sf::RectangleShape rectangle(sf::Vector2f(m_X(app), m_Y(app)));

		rectangle.setPosition(sf::Vector2f(m_X(app), m_Y(app)));

		// change the size to 100x100
		rectangle.setSize(sf::Vector2f(m_width, m_height));

		rectangle.setFillColor(sf::Color(64, 64, 64, 192));
		rectangle.setOutlineColor(sf::Color(192, 192, 192, 255));

		app.draw(rectangle);
		*/
		getText()->setPosition(m_X(app), m_Y(app));
		app.draw(*getText());
	}