This project is read-only.
ActionMapping is a easy way to get input data from different input devices. Basically you create a action of a special type, name it and map a input device to it. You are able to check the action for input by using one of the following methods:
  • IsActionHeld
With IsActionHeld you are able to check, if control buttons mapped to a action mapping is held down. Held down is a button that is pushed and not released.
  • IsActionPress
This method returns true when a button is pressed in the current frame and was not in the last frame.
  • IsActionRelease
This method is the opposite of IsActionPress. It returns true when an button is not pressed in this frame and was pressed in the last.

Each action, as every input, is mapped to a LogicalPlayer.

During creation of a new action you have to decide which action type you want to use. The following action types are available at the moment:

The following, very basic example shows you how to obtain the mouse position and the status of the left mouse button from the InputManager:

AnalogAxisAction aaa = inputManager.createAction("MOUSE_POSITION", typeof(AnalogAxisAction)) as AnalogAxisAction;
aaa.AddPositionalControl(inputManager.GetInputDevice(MouseAxis.POSITION, LogicalPlayerIndex.One));

TriggerAction ta = inputManager.createAction("MOUSE_LEFT", typeof(TriggerAction)) as TriggerAction;
ta.AddDigitalControl(inputManager.GetInputDevice(MouseButtons.LeftButton, LogicalPlayerIndex.One));

//
// obtaining input data
//
Vector2 pos = inputManager.ActionPosition("MOUSE_POSITION");
Boolean mouseHeld = inputManager.IsActionHeld("MOUSE_LEFT");

Last edited Dec 15, 2010 at 8:39 AM by Glatzemann, version 2

Comments

No comments yet.