Here are the examples of the csharp api System.Collections.Generic.List.Add(vJoyAxisInfos) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
19
View Source File : vJoyFeeder.cs
License : MIT License
Project Creator : njz3
License : MIT License
Project Creator : njz3
public int Acquire(uint id)
{
// Device ID can only be in the range 1-16
vJoyDevID = id;
Report.bDevice = (byte)vJoyDevID;
if (vJoyDevID <= 0 || vJoyDevID > 16) {
LogFormat(LogLevels.ERROR, "Illegal device ID {0}\nExit!", vJoyDevID);
return -1;
}
// Get the state of the requested device
VjdStat status = Joystick.GetVJDStatus(vJoyDevID);
switch (status) {
case VjdStat.VJD_STAT_OWN:
LogFormat(LogLevels.DEBUG, "vJoy Device {0} is already owned by this feeder", vJoyDevID);
break;
case VjdStat.VJD_STAT_FREE:
LogFormat(LogLevels.DEBUG, "vJoy Device {0} is free", vJoyDevID);
break;
case VjdStat.VJD_STAT_BUSY:
LogFormat(LogLevels.ERROR, "vJoy Device {0} is already owned by another feeder\nCannot continue", vJoyDevID);
return -3;
case VjdStat.VJD_STAT_MISS:
LogFormat(LogLevels.ERROR, "vJoy Device {0} is not installed or disabled\nCannot continue", vJoyDevID);
return -4;
default:
LogFormat(LogLevels.ERROR, "vJoy Device {0} general error\nCannot continue", vJoyDevID);
return -1;
};
// Get the number of buttons and POV Hat switchessupported by this vJoy device
this.NbButtons = Joystick.GetVJDButtonNumber(vJoyDevID);
int ContPovNumber = Joystick.GetVJDContPovNumber(vJoyDevID);
int DiscPovNumber = Joystick.GetVJDDiscPovNumber(vJoyDevID);
// Print results
LogFormat(LogLevels.DEBUG, "vJoy Device {0} capabilities:", vJoyDevID);
LogFormat(LogLevels.DEBUG, "Numner of buttons\t\t{0}", this.NbButtons);
LogFormat(LogLevels.DEBUG, "Numner of Continuous POVs\t{0}", ContPovNumber);
LogFormat(LogLevels.DEBUG, "Numner of Descrete POVs\t\t{0}", DiscPovNumber);
// Check which axes are supported. Follow enum HID_USAGES
ConfiguredvJoyAxes.Clear();
int i = 0;
foreach (HID_USAGES toBeTested in Enum.GetValues(typeof(HID_USAGES))) {
// Skip POV
if (toBeTested == HID_USAGES.HID_USAGE_POV)
continue;
var present = Joystick.GetVJDAxisExist(vJoyDevID, toBeTested);
LogFormat(LogLevels.DEBUG, "Axis " + HIDAxesInfo[i].Name + " \t\t{0}", present ? "Yes" : "No");
if (present) {
HIDAxesInfo[i].IsPresent = present;
// Retrieve min/max from vJoy
if (!Joystick.GetVJDAxisMin(vJoyDevID, toBeTested, ref HIDAxesInfo[i].MinValue)) {
Log("Failed getting min value!");
}
if (!Joystick.GetVJDAxisMax(vJoyDevID, toBeTested, ref HIDAxesInfo[i].MaxValue)) {
Log("Failed getting min value!");
}
Log(" Min= " + HIDAxesInfo[i].MinValue + " Max=" + HIDAxesInfo[i].MaxValue);
// Add to indexed list of configured axes
ConfiguredvJoyAxes.Add(HIDAxesInfo[i]);
}
i++;
}
// Acquire the target
if ((status == VjdStat.VJD_STAT_OWN) || ((status == VjdStat.VJD_STAT_FREE) && (!Joystick.AcquireVJD(vJoyDevID)))) {
LogFormat(LogLevels.ERROR, "Failed to acquire vJoy device number {0}.", vJoyDevID);
return -1;
} else {
LogFormat(LogLevels.DEBUG, "Acquired: vJoy device number {0}.", vJoyDevID);
}
return (int)status;
}