ProfilerKeyboardHandler.cs 721 B

12345678910111213141516171819202122232425262728293031
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using OpenTK.Input;
  5. namespace Ryujinx.Profiler
  6. {
  7. public struct ProfilerButtons
  8. {
  9. public Key ToggleProfiler;
  10. }
  11. public class ProfilerKeyboardHandler
  12. {
  13. public ProfilerButtons Buttons;
  14. private KeyboardState _prevKeyboard;
  15. public ProfilerKeyboardHandler(ProfilerButtons buttons)
  16. {
  17. Buttons = buttons;
  18. }
  19. public bool TogglePressed(KeyboardState keyboard) => !keyboard[Buttons.ToggleProfiler] && _prevKeyboard[Buttons.ToggleProfiler];
  20. public void SetPrevKeyboardState(KeyboardState keyboard)
  21. {
  22. _prevKeyboard = keyboard;
  23. }
  24. }
  25. }