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

Author Topic: [SFML 1.6] Mouse tracking independently?  (Read 2000 times)

0 Members and 1 Guest are viewing this topic.

Razzeeyy

  • Newbie
  • *
  • Posts: 17
    • View Profile
[SFML 1.6] Mouse tracking independently?
« 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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
[SFML 1.6] Mouse tracking independently?
« Reply #1 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.
Laurent Gomila - SFML developer

Razzeeyy

  • Newbie
  • *
  • Posts: 17
    • View Profile
[SFML 1.6] Mouse tracking independently?
« Reply #2 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.

 

anything