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

Author Topic: Using mousewheelmoved  (Read 5906 times)

0 Members and 1 Guest are viewing this topic.

Baron Pi

  • Newbie
  • *
  • Posts: 8
    • View Profile
Using mousewheelmoved
« on: January 19, 2008, 01:20:22 pm »
I don't know how to determine in what direction the mouse wheel moved, i.e. "up" or "down". I am trying to accomplish a simple zoom function using views. I have the following statement:
if(Event.Type == sf::Event::MouseWheelMoved)
{
  //i.e. zoom in
  View.Zoom += 10*App.GetFrameTime();
}
else if(Event.Type == sf::Event::MouseWheelMoved)
{
  //i.e. zoom out
  View.Zoom -= 10*App.GetFrameTime();
}

but I would also need something saying in what direction the mouse wheel moved. . . Any suggestions?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Using mousewheelmoved
« Reply #1 on: January 19, 2008, 05:01:30 pm »
Use Event.MouseWheel.Delta when you receive a MouseWheelMoved event.
Laurent Gomila - SFML developer

Baron Pi

  • Newbie
  • *
  • Posts: 8
    • View Profile
Using mousewheelmoved
« Reply #2 on: January 19, 2008, 05:25:44 pm »
OK great! Thanks!

 

anything