joystick.cs
using System;
using Microsoft.DirectX.DirectInput;
namespace gameproject
{
/// <summary>
/// Description of device.
/// </summary>
class joysticks
{
public static Device joystick;
public static JoystickState state;
public static void InitDevices() //Function of initialize device
{
//create joystick device.
foreach (DeviceInstance di in Manager.GetDevices(
DeviceClass.GameControl,
EnumDevicesFlags.AttachedOnly))
{
joystick = new Device(di.InstanceGuid);
break;
}
if (joystick == null)
{
//Throw exception if joystick not found.
}
//Set joystick axis ranges.
else {
foreach (DeviceObjectInstance doi in joystick.Objects)
{
if ((doi.ObjectId & (int)DeviceObjectTypeFlags.Axis) != 0)
{
joystick.Properties.SetRange(
ParameterHow.ById,
doi.ObjectId,
new InputRange(-5000, 5000));
}
}
joystick.Properties.AxisModeAbsolute = true;
joystick.SetCooperativeLevel(null,CooperativeLevelFlags.NonExclusive | CooperativeLevelFlags.Background);
//Acquire devices for capturing.
joystick.Acquire();
state = joystick.CurrentJoystickState;
}
}
public static void UpdateJoystick() // Capturing from device joystick
{
//Get Joystick State.
if(joystick!=null)
state = joystick.CurrentJoystickState;
}
}
}
In this line, an error occurred,
joystick.SetCooperativeLevel(null,CooperativeLevelFlags.NonExclusive
| CooperativeLevelFlags.Background);
error,
Error 1 The type 'System.Windows.Forms.Control' is defined in an
assembly that is not referenced.
You must add a reference to assembly 'System.Windows.Forms...
I'm working on,XNA 3.0 and .NET 3.5, so what means that error?