O'Reilly logo

SFML Blueprints by Maxime Barbier

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Managing user inputs

Managing the events received from the user is a really important topic. SFML provides us with two different approaches. The first is by polling the events received from a sf::Window instance, and the other is by checking the state in real time of an entry.

First of all, what is an event?

Generally, an event is an object that is triggered when something changes/happens. They are OS-dependent, but SFML provides us with a nice object to handle them in an OS-independent way. This is the sf::Event class. This class deals with a vast number of events, as follows:

  • Windows contains four different kinds of events. They are as follows:
    • Close
    • Resize
    • Gain/lose focus
    • The mouse pointer goes in/out of the window
  • There are three events for the mouse. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required