コード例 #1
0
        public IEnumerator <InputTwinState> InputIterator()
        {
            InputState     previous   = new InputState();
            InputTwinState twinState  = null;
            StringBuilder  textBuffer = new StringBuilder();

            Window.TextInput += (sender, e) =>
            {
                textBuffer.Append(e.Character);
            };

            while (true)
            {
                var keyboard = Keyboard.GetState();
                var mouse    = Mouse.GetState();
                var gamepad  = GamePad.GetState(0);

                InputState next = new InputState(keyboard, mouse, gamepad, textBuffer.ToString());
                twinState = new InputTwinState(previous, next, twinState);
                twinState.HandleRepeats();
                yield return(twinState);

                previous = next;
                textBuffer.Clear();
            }
        }
コード例 #2
0
ファイル: Input.cs プロジェクト: DaedalusGame/RogueTower
 public InputTwinState(InputState previous, InputState next, InputTwinState old)
 {
     Previous = previous;
     Next     = next;
     if (old != null)
     {
         KeyRepeats    = old.KeyRepeats;
         ButtonRepeats = old.ButtonRepeats;
     }
     else
     {
         KeyRepeats    = new Dictionary <Keys, KeyRepeat>();
         ButtonRepeats = new Dictionary <Buttons, KeyRepeat>();
     }
 }