Introducing the event manager
Figuring out what we want from our application is the first and the most crucial part of the design process. Sometimes it's difficult to cover all your bases, but forgetting about a feature that might alter the way all the code is structured and trying to implement it later can wreak some serious havoc on all the work you put into your software. Having said that, let's make a list of what features we want our event manager to have:
- The ability to couple any mix of keys, buttons, or events (from now on referred to as bindings) with desired functionality identified by a string
- Binding of the said functionalities to methods that get called if all the conditions (such as a key being pressed, the left mouse button being clicked, or the window losing focus, for example) for the binding are satisfied
- A way through which the event manager can deal with actual SFML events being polled
- Loading the bindings from a configuration file
We have our specifications, now...