Protogame.DefaultKeyboardStringReader.ProcessKey C# (CSharp) Méthode

ProcessKey() private méthode

Modifies the StringBuilder based on the pressed key.
private ProcessKey ( Microsoft.Xna.Framework.Input.Keys key, bool shift, bool capsLock, bool numLock, StringBuilder text ) : void
key Microsoft.Xna.Framework.Input.Keys /// The key being pressed. ///
shift bool /// Is the shift key down or capslock on?. ///
capsLock bool /// Is caps lock on?. ///
numLock bool /// Is num lock on?. ///
text StringBuilder /// The StringBuilder to be modified. ///
Résultat void
        private void ProcessKey(Keys key, bool shift, bool capsLock, bool numLock, StringBuilder text)
        {
            if (key == Keys.Back && text.Length > 0)
            {
                text = text.Remove(text.Length - 1, 1);
            }

            var newChar = GetCharacter(key, shift, capsLock, numLock);

            if (newChar.HasValue)
            {
                text.Append(newChar.Value);
            }
        }
    }