- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在学习 XNA(v. 4.0),并且正在努力使用键盘上的箭头键移动 Sprite ,并在按住空格时使角色冲刺。
下面是我的代码,用于确定按下了哪些键:
currentKBState = Keyboard.GetState();
bool right = currentKBState.IsKeyDown(Keys.Right);
bool left = currentKBState.IsKeyDown(Keys.Left);
bool up = currentKBState.IsKeyDown(Keys.Up);
bool down = currentKBState.IsKeyDown(Keys.Down);
bool space = currentKBState.IsKeyDown(Keys.Space);
System.Diagnostics.Debug.WriteLine(String.Format("{0} {1} {2} {3} {4}", right, left, up, down, space));
问题是我无法同时按下所有 5 个按钮。有时只有两个人会注册。例如,如果我按住向上、向下和向左,则无论我按住这三个键多长时间,它都只表示向上和向下是正确的。我希望能够处理无论按下什么组合。为什么它不记录所有被按下的按钮?我需要采取不同的方式吗?
最佳答案
这不是代码问题。这是键盘硬件的限制。
廉价键盘可以可靠地检测两个并发按键,但在三个按键的某些组合下可能会失败。
Modern keyboards detect ghosting, and instead of registering a fourth key, they will ignore the third key, which is known as jamming. Which keys jam when pressed together differs between brands and models of keyboards. Due to the keyboard matrix most consumer keyboards use, jamming and ghosting often occur when three out of four keys in a square block on the matrix are pressed, such as QASW or JKUI.
关于c# - XNA Keyboard.GetState() 不返回所有按下的键,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22237518/
我一直在尝试将 Redux 集成到项目中。 我按照使用示例进行操作,但收到错误store.getState is not a function。 所以我知道其他人也问过类似的问题,但情况略有不同。 R
我正在尝试将 react 粘性标题添加到我的步进器中。 但问题是,如果我在 App.js 中添加它,它就不会渲染。 所以我开始调试 App.js 代码。 如果我在 App.js 的渲染方法中提供控制台
我是使用线程的新手,我正在尝试找出一种方法来判断线程是否终止,以及从线程收集一些信息。但是,每当我尝试调用其中一个线程的方法(包括 thread.getState())时,我都会收到空指针异常。请我想
我有这个字节码: new java.lang.Object // stack is [newObjectRef] dup // Stack is [newObjectR
我对 redux 中的 getState() 有点困惑。我正在使用 thunk 中间件。 我有一个身份验证操作,它是一个异步操作。但是我有一个在其之前运行的操作,它检查状态中是否存在 token 以及
很难说出这里问的是什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或言辞激烈,无法以目前的形式合理回答。如需帮助澄清此问题以便可以重新打开,visit the help center . 8年前关闭
我正在构建一个同构的 React 应用程序,并且当用户发送请求时执行以下任务: 1) 假设用户点击 /about-us,react-routers matchPath 找到合适的组件并返回它。 2)
我有一个 React 应用程序,现在我使用 redux。该应用程序运行正常,但现在我收到错误: Uncaught TypeError: Cannot read property 'getState'
我想使用 SlidingPaneLayout.getState();但没有找到。是否被删除以及何时删除? public void showAudioPlayer() { mActivi
我如何从 zfcUser 获取状态 在 view/index.phtml 中,我从 $this->zfcUserIdentity()->getState(); 获取它; 但现在我需要在其他模块/ Co
我在 React Native 中的商店遇到了一些问题。我在我的文件 store/index.js 中配置了存储。我将其导出,然后导入到 App.js 中。来自 reducer 的 Action 正确
我想断言,当函数使用 store.getState() 获取我的 redux 状态值时,它会根据该状态的条件执行各种操作。对于使用 store.getState() 方法的某些测试,我如何断言/模拟我
让我坚持了好几天的问题是,虽然我的 redux devtool 显示状态更新成功,没有任何类型的突变,并且 View 组件重新渲染成功,但是当我调用 getState() 时,它总是返回初始状态并且不
我有一个下面的 Singleton 类,在我的 getStatement 方法中,我通过执行 if 检查来填充 CHM。 public class CacheHolder { private st
我正在尝试获取 webRTC 应用程序的统计信息以测量音频/视频流带宽。我检查了这个 question我发现它非常有用;但是,当我尝试使用它时,我得到了 TypeError: Not enough a
func (t *ballot) initBallot(stub shim.ChaincodeStubInterface, args []string) peer.Response { if
我正在尝试使用 redux 制作一个 nextjs 应用程序,并且我正在设置基本框架。 它如下所示。 服务器.js const express = require("express"); const
我昨天刚开始使用 redux,在阅读了不同的库之后,我决定使用 RTK 的切片路由。 对于我的异步,我决定使用 RTK 查询而不是使用 createAsyncThunk,并且我对从另一个切片访问状态的
我正在尝试使用 WebRTC 的 api 中的 getStat() 来查看它是否提供了任何有用的信息测量延迟和其他视频流数据。问题是关于如何使用它的信息并不多。 即使是较旧的现有示例也非常罕见,但此后
假设我在全局商店中有很多实体 苹果 商店 果汁 如果我想要函数 getAppleJuicePrice,我可以通过 2-3 种方式实现 通过参数 function getAppleJuicePrice(
我是一名优秀的程序员,十分优秀!