SFML community forums
Help => General => Topic started by: TheDistur on June 09, 2011, 10:29:39 pm
-
Is there a function to convert a world coordinate to a window coordinate? I want to be able to use RenderWindow.SetCursorPosition() to set the cursor to a world coordinate. If there is not a function, does anyone have a preferred method of doing this?
-
This function doesn't exist. The conversion is not complicated (in SFML 1.6), a sf::View only has a position and a size; you just need to apply the inverse operation.
Out of curiosity... what are you doing? So far, I've only seen people using SetCursorPosition to implement first person camera movement.
-
I'm using box2d with sfml and I'm creating objects by clicking and dragging the mouse. When dragging I don't want the cursor to go past the corner of the ghost object when it hits another object (checked using box2d). Otherwise the cursor keeps going past the corner of the ghost and I think that looks strange. It's not really that important though.