public void Initialise(IntPtr handle) { try { DirectInput = DInput.DirectInput8Create(); _keyboards = EnumerateAllAttachedKeyboardDevices(DirectInput); foreach (var item_ in _keyboards) { InitialiseKeyboardDevice(DirectInput, item_.Key, handle); } _joysticks = EnumerateAllAttachedGameDevices(DirectInput); foreach (var item_ in _joysticks) { InitialiseJoystickDevice(DirectInput, item_.Key, handle); } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
unsafe internal override bool OnInit() { NativeLibraryManager.PreLoadLibrary("NeoAxisCoreNative"); try { void *directInputTemp; GUID iidDirectInput = DInput.IID_IDirectInput8W; int hr = DInput.DirectInput8Create(ref iidDirectInput, out directInputTemp); if (global::DirectInput.Wrapper.FAILED(hr)) { Log.Warning("WindowsInputDeviceManager: DirectInput8Create failed."); return(false); } directInput = (IDirectInput *)directInputTemp; if (!CreateDevices()) { return(false); } } catch { return(false); } return(true); }
public DIInputDevice() { _directInput = DInput.DirectInput8Create(); _keyboardDevices = new Dictionary <Guid, IDirectInputDevice8>(); _joystickDevices = new Dictionary <Guid, IDirectInputDevice8>(); }
/// <summary> /// Initializes a new instance of the <see cref="DirectInput"/> class. /// </summary> public DirectInput() : base(IntPtr.Zero) { IntPtr temp; DInput.DirectInput8Create(Win32Native.GetModuleHandle(null), DInput.SdkVersion, Utilities.GetGuidFromType(typeof(DirectInput)), out temp, null); NativePointer = temp; }