ProfilerKeyboardHandler.cs 654 B

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