Пример #1
0
	sf::ConvexShape toConvexShape(const sf::Shape& shape)
	{
		const unsigned int size = shape.getPointCount();

		sf::ConvexShape convexShape;

		// Adapt shape properties
		convexShape.setFillColor(shape.getFillColor());
		convexShape.setOutlineColor(shape.getOutlineColor());
		convexShape.setOutlineThickness(shape.getOutlineThickness());
		convexShape.setPointCount(size);

		// Adapt transform properties
		convexShape.setPosition(shape.getPosition());
		convexShape.setRotation(shape.getRotation());
		convexShape.setScale(shape.getScale());
		convexShape.setOrigin(shape.getOrigin());

		// Adapt texture properties
		convexShape.setTexture(shape.getTexture());
		convexShape.setTextureRect(shape.getTextureRect());

		for (unsigned int i = 0; i < size; ++i)
		{
			convexShape.setPoint(i, shape.getPoint(i));
		}

		return convexShape;
	}