Beispiel #1
0
        private void NativeInputRadioButton_CheckedChanged(object sender, EventArgs e)
        {
            INativeInput nativeInput = glControl.EnableNativeInput();

            if (_nativeInput == null)
            {
                _nativeInput = nativeInput;

                _nativeInput.MouseDown += (e) =>
                {
                    glControl.Focus();
                    Log("Native Mouse down");
                };
                _nativeInput.MouseUp += (e) =>
                                        Log("Native Mouse up");
                _nativeInput.MouseMove += (e) =>
                                          Log($"Native Mouse move: {e.DeltaX},{e.DeltaY}");
                _nativeInput.KeyDown += (e) =>
                                        Log($"Native Key down: {e.Key}");
                _nativeInput.KeyUp += (e) =>
                                      Log($"Native Key up: {e.Key}");
                _nativeInput.TextInput += (e) =>
                                          Log($"Native Text input: {e.AsString}");
                _nativeInput.JoystickConnected += (e) =>
                                                  Log($"Native Joystick connected: {e.JoystickId}");
            }
        }
Beispiel #2
0
 public InputManager(IInputSettings settings, INativeInput input)
 {
     _inputSettings = settings;
     _input         = input;
     _input.OnTick += CheckKeys;
     foreach (var key in _inputSettings.GetKeys())
     {
         _keyStates.Add(key, KeyState.Released);
     }
     _keys = _inputSettings.GetKeys();
 }