SFML community forums

Help => Window => Topic started by: Razzeeyy on January 02, 2012, 10:15:47 pm

Title: [SFML 1.6] Mouse tracking independently?
Post by: Razzeeyy on January 02, 2012, 10:15:47 pm
Is there any way of tracking mouse almost (while it's in window bounds) permanently?
Not only when it's moved but also when it just stay in the same position.

The code like this gives weird behavior when the mouse not moved, but clicked (the coordinates just jumping, or something like that, to the opposite side for a second).

Code: [Select]
sf::Vector2f MousePosition(Event.MouseMove.X, Event.MouseMove.Y);
The_Tank.GetGun().AimAt(MousePosition);


Any ideas?
The newb(me) forehand thank you. :)

P.S. Also Is there any person interested in 2D top-down view game development? I'm trying myself at that, and would be fine to see another person who can assist me or at least give a piece of advice.
Title: [SFML 1.6] Mouse tracking independently?
Post by: Laurent on January 02, 2012, 10:53:06 pm
Event.MouseMove can only be used after you get a MouseMoved event...

Use sf::Input instead. But it won't work when the cursor is outside the window, you must upgrade to SFML 2 to get what you want.
Title: [SFML 1.6] Mouse tracking independently?
Post by: Razzeeyy on January 02, 2012, 11:44:41 pm
Quote from: "Laurent"
Use sf::Input instead. But it won't work when the cursor is outside the window, you must upgrade to SFML 2 to get what you want.


I'm ok with that :) At least I'm all-mighty inside the window :D
Ty again for help.