private unsafe int DirectInputEnumObjectsImpl(void* deviceInstance, IntPtr data) { var newObject = new DeviceObjectInstance(); newObject.__MarshalFrom(ref *((DeviceObjectInstance.__Native*)deviceInstance)); Objects.Add(newObject); // Return true to continue iterating return 1; }
private unsafe int DirectInputEnumObjectsImpl(void *deviceInstance, IntPtr data) { var newObject = new DeviceObjectInstance(); newObject.__MarshalFrom(ref *((DeviceObjectInstance.__Native *)deviceInstance)); Objects.Add(newObject); // Return true to continue iterating return(1); }
protected void OnDeviceFound(DeviceType t, DeviceObjectInstance i) { if (DeviceFound != null) { DeviceFound(this, new DeviceFoundArguments(t, i)); } }
void UpdateControl(DeviceObjectInstance d) { if (ObjectGuid.Button == d.ObjectType) { OnDeviceFound(DeviceType.Button, d); return; } else if (ObjectGuid.PovController == d.ObjectType) { OnDeviceFound(DeviceType.Pov, d); return; } else if (ObjectGuid.Slider == d.ObjectType) { OnDeviceFound(DeviceType.Slider, d); } else { OnDeviceFound(DeviceType.Unknown, d); } }
/// <summary> /// Enable the properties that are supported by the device /// </summary> /// <param name="d"></param> private void UpdateControls( DeviceObjectInstance d ) { // Set the UI to reflect what objects the joystick supports. if ( ObjectGuid.XAxis == d.ObjectType ) { m_jPanel.Xe = true; m_jPanel.Xname = d.Name + ":"; } if ( ObjectGuid.YAxis == d.ObjectType ) { m_jPanel.Ye = true; m_jPanel.Yname = d.Name + ":"; } if ( ObjectGuid.ZAxis == d.ObjectType ) { m_jPanel.Ze = true; m_jPanel.Zname = d.Name + ":"; } if ( ObjectGuid.RxAxis == d.ObjectType ) { m_jPanel.Xre = true; m_jPanel.Xrname = d.Name + ":"; } if ( ObjectGuid.RyAxis == d.ObjectType ) { m_jPanel.Yre = true; m_jPanel.Yrname = d.Name + ":"; } if ( ObjectGuid.RzAxis == d.ObjectType ) { m_jPanel.Zre = true; m_jPanel.Zrname = d.Name + ":"; } if ( ObjectGuid.Slider == d.ObjectType ) { switch ( m_sliderCount++ ) { case 0: m_jPanel.S1e = true; m_jPanel.S1name = d.Name + ":"; break; case 1: m_jPanel.S2e = true; m_jPanel.S2name = d.Name + ":"; break; } } if ( ObjectGuid.PovController == d.ObjectType ) { switch ( m_numPOVs++ ) { case 0: m_jPanel.H1e = true; m_jPanel.H1name = d.Name + ":"; break; case 1: m_jPanel.H2e = true; m_jPanel.H2name = d.Name + ":"; break; case 2: m_jPanel.H3e = true; m_jPanel.H3name = d.Name + ":"; break; case 3: m_jPanel.H4e = true; m_jPanel.H4name = d.Name + ":"; break; } } }