Original Post
We're trying to use ActionMap for our Game....my first try didn't work right away. I always got an ArgumentException:
Value does not fall within the expected range.
This happened depending on where I Initialized my ActionMap stuff....at first I got that exception when I called the enumeration method:
DeviceList DevList = Manager.GetDevices(DIActionFormat, EnumDevicesBySemanticsFlags.AvailableDevices);
But after rearranging my code a bit...I got the same exception where the Mouse device was acquired:
foreach (DeviceState state in DeviceStates)
{
BufferedDataCollection dataCollection;
int curState = 0;
try
{
state.Device.Acquire();
state.Device.Poll();
dataCollection = state.Device.GetBufferedData();
}
catch(DirectXException)
{
continue;
}
if (null == dataCollection)
continue;
if (!state.IsAxisAbsolute)
{
state.InputState[(int)GameActions.RotateX] = 0;
state.InputState[(int)GameActions.RotateY] = 0;
}
The Microsoft Example worked fine though....so I put in the only thing that was different between my Code and MS code....some Actions for the Mouse.
I already had all the Actions for the Keyboard defined, but none for the mouse. And then it worked. Is it really true that you can't use ActionMap with the Default Mapping of just one Device ie Keyboard without having to define a Default Map for all other attached devices???
I could do with defining Action for Keyboard and Mouse...but then just recently we tried that code (and the Microsoft Example) on another machine.
That machine had a GameVoice device attached....and we got the above exception again.
Does anyone have a solution to this problem? Did anyone make different experiences with ActionMap?
It's a great thing...I'd like to use to for our game....
[edited by - djc on June 1, 2003 8:14:31 AM]