Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
SFML Blueprints

You're reading from   SFML Blueprints Sharpen your game development skills and improve your C++ and SFML knowledge with five exciting projects

Arrow left icon
Product type Paperback
Published in May 2015
Publisher Packt
ISBN-13 9781784398477
Length 298 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Toc

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. They are as follows:
    • Move
    • Key press/release
    • Wheel press, release, or move
  • The keyboard contains two events. They are as follows:
    • Keys press/release
    • Text entered
  • The joystick is also managed with four events. They are as follows:
    • Connected/disconnected...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at AU $24.99/month. Cancel anytime