sf::RectangleShape Spriteeditor::shapeRealBorder(Sprite * sprite, sf::RectangleShape shape)
{
	shape.setPosition(sprite->getPosition().x, sprite->getPosition().y);
	sf::Rect<float> border = sprite->getLocalBounds();
	shape.setSize(sf::Vector2f(border.width, border.height));
	shape.setScale(sprite->getScale());
	shape.setRotation(sprite->getRotation());
	return shape;
}
Example #2
0
void cWindow::paintClouds()
{
	brushRect.setScale(vec2f(1.00f, 1.00f));
	brushRect.setFillColor(color(0, 0, 0));
	//brushRect.setTexture(&visual.gameTex[database.texture[TEX_CLOUD]].handle);
	sf::FloatRect camRect(camera.pos.x, camera.pos.y, camera.res.x, camera.res.y);
	mutex.renderClouds.lock();
	visual.cloudsPainted = 0;
	for (int i = 0; i < (int)weather.cloud.size(); i++)
	{
		//brushRect.setTexture(&weather.cloudTexture[i], true);
		brushRect.setTexture(&visual.gameTex[weather.cloud[i].tex].handle, true);
		brushRect.setPosition(weather.cloud[i].pos);
		brushRect.setSize(weather.cloud[i].size);
		brushRect.setOrigin(weather.cloud[i].size / 2.00f);
		if (camRect.intersects(brushRect.getGlobalBounds())) {
			window.texHandleShadow.draw(brushRect, window.matrixHandle);
			visual.cloudsPainted += 1;
		}
	}
	mutex.renderClouds.unlock();
}