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

Author Topic: Combined event types  (Read 4364 times)

0 Members and 1 Guest are viewing this topic.

Crank1d

  • Newbie
  • *
  • Posts: 14
    • View Profile
Combined event types
« on: March 12, 2010, 05:51:33 pm »
I am new to SFML, so I still learn new stuff about library everyday but I am interested is it possible to combine event types? For example, i want to create rotational camera with OpenGL which user rotates when he press right mouse button and moves mouse. Ive tried something like this:

Code: [Select]
if ((Event.Type == sf::Event::MouseButtonPressed || sf::Event::MouseMoved) && (sf::Mouse::Right))


but it doesn´t do nothing.
If needed, I would post whole source code of application.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Combined event types
« Reply #1 on: March 12, 2010, 07:58:29 pm »
You don't want to combine mouse pressed + mouse moved, you want to react on mouse move when the mouse button is pressed, which is something different ;)
Code: [Select]
if (Event.Type == sf::Event::MouseMoved && Window.GetInput().IsMouseButtonDown(...))
Laurent Gomila - SFML developer

Crank1d

  • Newbie
  • *
  • Posts: 14
    • View Profile
Combined event types
« Reply #2 on: March 12, 2010, 08:47:21 pm »
Thanks Laurent! Everything works just fine, you rule.  8)

 

anything