You now have all the information you need to add keyboard and mouse support to your games. But let’s transform this code into something more reusable and avoid having to write any DirectInput code again in the future. To maximize code reuse, I’ve written a helper class called Input that encapsulates the keyboard and mouse. This class will be utilized by the Advanced2D engine to automatically provide keyboard and mouse events to a game.