aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Profiler/ProfilerKeyboardHandler.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Profiler/ProfilerKeyboardHandler.cs')
-rw-r--r--Ryujinx.Profiler/ProfilerKeyboardHandler.cs31
1 files changed, 31 insertions, 0 deletions
diff --git a/Ryujinx.Profiler/ProfilerKeyboardHandler.cs b/Ryujinx.Profiler/ProfilerKeyboardHandler.cs
new file mode 100644
index 00000000..e1075c8d
--- /dev/null
+++ b/Ryujinx.Profiler/ProfilerKeyboardHandler.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using OpenTK.Input;
+
+namespace Ryujinx.Profiler
+{
+ public struct ProfilerButtons
+ {
+ public Key ToggleProfiler;
+ }
+
+ public class ProfilerKeyboardHandler
+ {
+ public ProfilerButtons Buttons;
+
+ private KeyboardState _prevKeyboard;
+
+ public ProfilerKeyboardHandler(ProfilerButtons buttons)
+ {
+ Buttons = buttons;
+ }
+
+ public bool TogglePressed(KeyboardState keyboard) => !keyboard[Buttons.ToggleProfiler] && _prevKeyboard[Buttons.ToggleProfiler];
+
+ public void SetPrevKeyboardState(KeyboardState keyboard)
+ {
+ _prevKeyboard = keyboard;
+ }
+ }
+}