[英]How can a .net-core application read the keyboard state, irrespective of the operating system?
I am trying to detect the pressed keys in an application for Linux and Windows. 我正在尝试检测Linux和Windows应用程序中的按下键。 Text can be read using
System.Console
, but that fails when multiple keys are pressed simultaneously. 可以使用
System.Console
读取文本,但是当同时按下多个键时,文本将失败。 On Windows, using regular .net, the keyboard state can be read using System.Windows.Input
. 在Windows上,使用常规.net,可以使用
System.Windows.Input
读取键盘状态。 But how can I do the same on Linux? 但是如何在Linux上做同样的事情? Or is there another better solution for all of .net-core?
还是为所有.net-core提供更好的解决方案?
Microsoft.Xna.Framework.Input
contains exactly this functionality. Microsoft.Xna.Framework.Input
完全包含此功能。 It can be added to the project through the NuGet package MonoGame
. 可以通过NuGet包
MonoGame
将其添加到项目中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.