コード例 #1
0
ファイル: Input.cs プロジェクト: TASeditor/BizHawk
        internal Input(IntPtr mainFormHandle, Func <Config> getConfigCallback, Func <bool, AllowInput> mainFormInputAllowedCallback)
        {
            _getConfigCallback = getConfigCallback;
            _currentConfig     = _getConfigCallback();
            _currentConfig.MergeLAndRModifierKeys = true;             // for debugging
            UpdateModifierKeysEffective();

            MainFormInputAllowedCallback = mainFormInputAllowedCallback;

            Adapter = _currentConfig.HostInputMethod switch
            {
                EHostInputMethod.OpenTK => new OpenTKInputAdapter(),
                _ when OSTailoredCode.IsUnixHost => new OpenTKInputAdapter(),
                EHostInputMethod.DirectInput => new DirectInputAdapter(),
                _ => throw new Exception()
            };
            Console.WriteLine($"Using {Adapter.Desc} for host input (keyboard + gamepads)");
            Adapter.UpdateConfig(_currentConfig);
            Adapter.FirstInitAll(mainFormHandle);
            _updateThread = new Thread(UpdateThreadProc)
            {
                IsBackground = true,
                Priority     = ThreadPriority.AboveNormal             // why not? this thread shouldn't be very heavy duty, and we want it to be responsive
            };
            _updateThread.Start();
        }
コード例 #2
0
        internal Input(IntPtr mainFormHandle, Func <Config> getConfigCallback, Func <bool, AllowInput> mainFormInputAllowedCallback)
        {
            _getConfigCallback           = getConfigCallback;
            MainFormInputAllowedCallback = mainFormInputAllowedCallback;

            var config = _getConfigCallback();

            Adapter = config.HostInputMethod switch
            {
                EHostInputMethod.OpenTK => new OpenTKInputAdapter(),
                EHostInputMethod.DirectInput => new DirectInputAdapter(),
                _ => throw new Exception()
            };
            Adapter.UpdateConfig(config);
            Adapter.FirstInitAll(mainFormHandle);
            _updateThread = new Thread(UpdateThreadProc)
            {
                IsBackground = true,
                Priority     = ThreadPriority.AboveNormal             // why not? this thread shouldn't be very heavy duty, and we want it to be responsive
            };
            _updateThread.Start();
        }