summaryrefslogtreecommitdiff
path: root/source/game/input/definitions/keyboard/TrinaryKeyboardDefinition.cs
blob: 7439859c3fae00b9765f75f0631132d034044968 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
using Microsoft.Xna.Framework.Input;

namespace Celesteia.Game.Input.Definitions.Keyboard {
    public class TrinaryKeyboardDefinition : IFloatInputDefinition {
        public Keys Negative;
        public Keys Positive;
        public InputPollType PollType;

        private float _current = 0;

        public float Test() {
            _current =
                (KeyboardHelper.Poll(Negative, PollType) ? -1 : 0) +
                (KeyboardHelper.Poll(Positive, PollType) ? 1 : 0);
            return _current;
        }
    }
}