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

Author Topic: Mouse Button Pressed and then Moved  (Read 105 times)

0 Members and 1 Guest are viewing this topic.


  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Email
Mouse Button Pressed and then Moved
« on: June 16, 2020, 01:53:14 pm »
Hi there.

I want my program to detect the following event: Mouse Button Pressed + Mouse Moved

I tried this way:
case sf::Event::MouseMoved:
    if (sf::Mouse::isButtonPressed) {

But this does not seem to be the thing I want. Any help would be appreciated. Thanks in advance.


  • SFML Team
  • Hero Member
  • *****
  • Posts: 9593
    • View Profile
    • development blog
    • Email
Re: Mouse Button Pressed and then Moved
« Reply #1 on: June 16, 2020, 02:07:28 pm »
You could track the mouse button state in a separate variable, so when you get a mouse moved event, you can check whether the mouse button is pressed or not.
Official FAQ: https://www.sfml-dev.org/faq.php
Nightly Builds: https://www.nightlybuilds.ch/
Dev Blog: https://dev.my-gate.net/
Thor: http://www.bromeon.ch/libraries/thor/