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

Author Topic: Transforming mouse coordinates  (Read 2527 times)

0 Members and 1 Guest are viewing this topic.

Imbue

  • Full Member
  • ***
  • Posts: 104
    • View Profile
Transforming mouse coordinates
« 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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Transforming mouse coordinates
« Reply #1 on: September 30, 2008, 10:46:54 pm »
In the SVN there are functions to transform to global / local drawable coordinates.
Laurent Gomila - SFML developer

Imbue

  • Full Member
  • ***
  • Posts: 104
    • View Profile
Transforming mouse coordinates
« Reply #2 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

 

anything