全部。我想用C#和XNA编写一个输入文本框。这是我的代码:
//Get the pressed key and show them
public void Update(GameTime gameTime)
{
KeyboardState keyState = Keyboard.GetState();
Keys[] pressedKeys;
pressedKeys = KeyState.GetPressedKeys();
messageString=" ";
for (int i = 0; i < pressedKeys.Length; i++)
messageString = messageString + pressedKeys[i].ToString() + "";
}
但是,我收到了类似的错误消息
Microsoft.Xna.Framework.Input.KeyState' does not contain a definition for 'GetPressedKeys'
有什么办法可以解决吗?
更新:我在这里有错字。使用以下答案可以解决问题。
PressedKeys = KeyState.GetPressedKeys(); 应该被按下= KeyState.GetPressedKeys();
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句