This project is read-only.
If you want to handle input data using Raw-Input-Handling you work on the device level. You have two different choices:
  1. get the InputDevice
  2. get a digital or analog control from a InputDevice

The first choice works like this:

GamepadDevice pad = inputManager.GetInputDevice(PlayerIndex.One, DeviceType.GAMEPAD) as GamepadDevice;

You will get a gamepad device which has different digital and analog controls each having a property for obtaining it's actual input state. You may ask yourself why we are using the PlayerIndex and not the LogicalPlayer here? On this low level we are working with the hardware index not some logical player indices. If you want to obtain the PlayerIndex of a logical player you can do this like this:

LogicalPlayerIndex logicalIndexOfPlayerOne = LogicalPlayer.GetPlayerIndex(PlayerIndex.One);

The second choice works like this:

IDigitalControl dc = inputManager.GetInputDevice(Buttons.A, LogicalPlayerIndex.One);

This method call will return a instance of a digital control representing the GamePad button A of the first LogicalPlayer. You can obtain the input state by using the different properties of the control object.

Last edited Dec 15, 2010 at 8:44 AM by Glatzemann, version 1


No comments yet.