SFML community forums

Help => General => Topic started by: declan on December 08, 2010, 03:38:26 am

Title: How can I group shapes/lines together?
Post by: declan on December 08, 2010, 03:38:26 am
Hey everyone!

I am trying to draw a ton of small arrows, which I then set the positions of, and rotate around the center of the arrow. Right now I'm doing it with regular lines and it's working fine, but I eventually want arrows. However, it would be a pain in the ass to rotate the two lines that make the head of the arrow around the center of the thing:

(http://imgur.com/YaVAn.png)


So my question is, is there any way to group the lines together so that I can manipulate them as a single, larger object?

Thanks!!
Title: How can I group shapes/lines together?
Post by: DeadLeaves on December 08, 2010, 05:44:47 pm
Wouldn't it work to use an image? Or make a polygon?
Title: How can I group shapes/lines together?
Post by: heishe on December 08, 2010, 05:52:22 pm
I think you can set the center of the other arrows two head lines to the middle of the other line, so they rotate around that.
Title: How can I group shapes/lines together?
Post by: danman on December 08, 2010, 08:33:05 pm
in fact, you need some transformations to be shared with all the arrows, so you could use something like a layer (a box that contains your arrows) :

http://www.sfml-dev.org/wiki/fr/sources/layer
Title: How can I group shapes/lines together?
Post by: declan on December 10, 2010, 07:19:41 am
Quote from: "DeadLeaves"
Wouldn't it work to use an image? Or make a polygon?


I suppose I could be clever and make a polygon that has no lines that cross, but I made a simple arrow out of a polygon with 4 or 5 lines, and it came out pretty awful. An image might not be a bad idea, but arrows drawn with lines seemed like the natural solution because they have to be resized and rotated a lot.
Title: How can I group shapes/lines together?
Post by: declan on December 10, 2010, 07:21:02 am
Quote from: "heishe"
I think you can set the center of the other arrows two head lines to the middle of the other line, so they rotate around that.


This is a clever idea...I think I'll try it. Still, I don't see why there wouldn't be some sort of group option.