Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Combine shapes and/or vertex arrays  (Read 1527 times)

0 Members and 1 Guest are viewing this topic.

ekner

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Email
Combine shapes and/or vertex arrays
« 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).



Can I render it to an image and transform it for example?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Combine shapes and/or vertex arrays
« Reply #1 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);
Laurent Gomila - SFML developer