Skip to main content
gamedev.net
🔒 Locked

ActionMap Problem

Started by djc Jun 1, 2003 at 7:06 AM 1 replies 500+ views
Original Post
djc
djc
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]
djc
djc
..forgot to say...we tried to enumerate using the value:

EnumDevicesBySemanticsFlags.AttachedOnly

but we had the same results....


....the Microsoft Sample didn't work on the Machine with GameVoice device either....as we had no default ActionMapping defined for that device.....

[edited by - djc on June 1, 2003 10:32:26 PM]
djc
djc
I think the problem is solved now....sort of.....

in the MS example they do the Acquire in a try/catch block....but they only catch DirectXExceptions ...which apparently in this case does not match. It seems there is a regular exception thrown....I switched it from DirectXException to Exception and it seems to work now.....regardless if a device is mapped or not....


Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.