SFML community forums

Help => General => Topic started by: Qluxzz on March 01, 2014, 06:15:03 am

Title: Scaling and Rotating objects in real time
Post by: Qluxzz on March 01, 2014, 06:15:03 am
Hi there, I'm working on a level editor and have gotten stuck. I know how to drag and drop the objects, but not how to scale them or rotate the objects according to the users mouse input.

For example I have a video of another persons level editor.
http://www.youtube.com/watch?v=E1KGlngYJ9E (http://www.youtube.com/watch?v=E1KGlngYJ9E)

I imagine it's not that difficult but I just can't think of how so all help is appreciated.

Thanks in advance Qluxzz
Title: Re: Scaling and Rotating objects in real time
Post by: zsbzsb on March 01, 2014, 06:43:57 am
Video isn't loading for me. But if I think I know what you are talking about. For scaling - it depends on the distance from the initial mouse button press to the current mouse position. For rotation - you need to use atan2 to calculate the rotation from the initial button press to the current mouse position.  ;)
Title: Re: Scaling and Rotating objects in real time
Post by: Nexus on March 01, 2014, 05:03:01 pm
I would do it as follows: