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);
            }
        }
Exemple #2
0
        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);
        }
Exemple #3
0
    public DIInputDevice()
    {
        _directInput = DInput.DirectInput8Create();

        _keyboardDevices = new Dictionary <Guid, IDirectInputDevice8>();
        _joystickDevices = new Dictionary <Guid, IDirectInputDevice8>();
    }
Exemple #4
0
        /// <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;
        }