SFML community forums

Help => Graphics => Topic started by: ekner on January 25, 2016, 09:18:49 pm

Title: Combine shapes and/or vertex arrays
Post by: ekner on January 25, 2016, 09:18:49 pm
If I have several shapes and/or vertex arrays, can combine them and then transform them together in some way?

For example, if I have two rectangles (1) normally when I rotate them I will look like this (2), but I want to rotate them from the same point (3).

(http://i.imgur.com/NeTFSNT.png)

Can I render it to an image and transform it for example?
Title: Re: Combine shapes and/or vertex arrays
Post by: Laurent on January 25, 2016, 10:27:49 pm
You just have to give them the same parent transform when you draw them.

sf::Transform transform;
transform.rotate(...);

window.draw(square1, transform);
window.draw(square2, transform);