SFML community forums

Help => General => Topic started by: Borek23 on May 07, 2012, 08:38:12 pm

Title: Getting mouse position.
Post by: Borek23 on May 07, 2012, 08:38:12 pm
Hi! I'm looking for my answer for about 2 days and still nothing. How to get mouse position even if in console in SMFL 2?
 That's what i get :
(http://i45.tinypic.com/347xq21.png)

Even if I change mouse position it would still be the same...  There's piece of code :
sf::Vector2i Mousepos;
Mousepos = sf::Mouse::getPosition(myWindow);

sf::Event event;
        if(event.type == sf::Event::MouseMoved)
        {
            cout << "Mouse position " << Mousepos.x << "\t " << Mousepos.y << endl;
        }
 

How can I change these positions ?
Sorry for mistakes...
Title: Re: Getting mouse position.
Post by: Laurent on May 07, 2012, 08:42:15 pm
You shouldn't mix events and real-time inputs. If you caught a MouseMoved event then use the event.mouseMove object, otherwise just use what sf::Mouse::getPosition returned without mixing with events.
Title: Re: Getting mouse position.
Post by: Borek23 on May 07, 2012, 09:56:53 pm
Thanks mate, problem solved  ;)