XNA数字锁定影响输入 [英] XNA Number lock affects input

查看:200
本文介绍了XNA数字锁定影响输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个中断了键盘上的按键给我协调的关键。当数字锁定为ON,键来充当NUMPAD1,NUMPAD2等。当数字锁定为OFF时,小键盘按键变成结束,左,右,上,PageLock ......我不能有这样的情况发生,因为我需要保持这些键(左,右..)为实际的方向键。宁愿具有输入不是由数字锁定在所有受到影响。不过,我似乎无法缓解这种因为我从XNA直接获取输入。别人可以证实这一点是在VS 2008?

I have an interrupt that on keyboard keypress gives me the coordinating key. When the number lock is ON, the keys come up as Numpad1, Numpad2, etc. When the number lock is OFF, the numpad keys turn into End, Left, Right, Up, PageLock... I cant have this happening because I need to keep those keys (Left, Right..) as the actual arrow keys. Id rather have the input not be affected by the number lock at all. However, I can't seem to mitigate this as I am getting the input from XNA directly. Can someone else confirm this is happening in XNA 3.1 on VS 2008?

推荐答案

XNA内部使用Win32函数的 GetKeyboardState 确定键盘状态。该功能无法数字键盘,方向键,插入组之间的差异。

XNA internally uses the win32 function GetKeyboardState to determine the keyboard state. This function cannot differentiate between the number pad, the arrow keys, and the insert group.

显然,你可以通过使用的 WM_KEYDOWN 的消息(和它的朋友)。

Apparently you are able to differentiate between the keys by using the WM_KEYDOWN message (and its friends).

我将离开在XNA应用程序获取的win32邮件所需的互操作,以及如何检查该消息的数据,练习。

I'll leave the interop required to get win32 messages in an XNA application, and how to check the data for the message, as an exercise.

(我个人会建议简单地修改你的控制方案,或者只是观察用户的NUM锁定状态。一般来说这是一个的坏主意的接手类似的Num-lock键的功能!)

(Personally I would recommend simply modifying your control scheme. Or just observing the user's num-lock state. Generally speaking it is a bad idea to take over the functionality of something like the num-lock key!)

这篇关于XNA数字锁定影响输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆