SFML community forums

Help => Window => Topic started by: Imbue on September 30, 2008, 09:01:59 pm

Title: Transforming mouse coordinates
Post by: Imbue on September 30, 2008, 09:01:59 pm
Just wondering, is there any way to transform mouse coordinates based on a drawable's position, scale, and rotation?

What is the standard idiom for seeing where the mouse it at on a rotated and translated object? What if the rotation is inherited from its parent? I really love that a group of objects can all be moved at once by simply being drawn by a parent drawable object.

BTW, SFML is great! It truly is a really great library.

Thanks.
Title: Transforming mouse coordinates
Post by: Laurent on September 30, 2008, 10:46:54 pm
In the SVN there are functions to transform to global / local drawable coordinates.
Title: Transforming mouse coordinates
Post by: Imbue on October 04, 2008, 09:00:47 pm
OK, great. Thanks for the quick reply.

If anyone else has the same question, the functions are sf::Drawable::TransformToLocal() and sf::Drawable::TransformToGlobal() in version 1.4.

But in version 1.3 it looks like I can just use the sf::Matrix3::Transform() function. I think for my project I'll be sub-classing sf::Drawable and going that route so I can propagate the transformation down through the hierarchy.

Thanks again. :D