aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Profiler/ProfilerKeyboardHandler.cs
blob: e6207e8924cd85c23ed18890e9e2705e510eb59a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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;
        }
    }
}