summaryrefslogtreecommitdiff
path: root/Plugins/MonoGame.Extended/source/MonoGame.Extended.Input/KeyboardExtended.cs
blob: 0ed7c7696249026f480db474481dbd490f5ca859 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
using Microsoft.Xna.Framework.Input;

namespace MonoGame.Extended.Input
{
    public static class KeyboardExtended
    {
        // TODO: This global static state was a horrible idea.
        private static KeyboardState _currentKeyboardState;
        private static KeyboardState _previousKeyboardState;

        public static KeyboardStateExtended GetState()
        {
            return new KeyboardStateExtended(_currentKeyboardState, _previousKeyboardState);
        }

        public static void Refresh()
        {
            _previousKeyboardState = _currentKeyboardState;
            _currentKeyboardState = Keyboard.GetState();
        }
    }
}