O'Reilly logo

Game Development with SlimDX by Michael Fontanini

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

Mouse and keyboard input

Even though players can play games using gamepads and other types of controllers, mouse and keyboard input are still quite important in PC game development. Some games have too many commands to map all of them on a gamepad, for example. When we assign an in-game action to a specific button on a keyboard, mouse, or gamepad, we say that we have mapped that action to that particular button. This is also sometimes referred to as binding, because we are, in effect, binding a certain key or button to a specific in-game action.

Let's first implement our mouse and keyboard input. Start Visual Studio and open the solution we worked on in the previous chapter. We are going to add a new class that will handle user input for us. Right-click ...

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