How is userinput kept independent of FPS when using for example Java Slick 2D or .NET XNA framework? -
I've written some 2D games using LWJGL (with Slick 2D cover) and XNA Framework, but I'm never able to understand one thing (or need it) that's how the user The input is kept constant, the EP is not dependent on FPS.
I'm looking for a more general answer instead. Structure I think that there is something to do with the time measured between frame updates?
Thanks
I can not talk about those other frameworks, but I know that XNA basically lets you vote on current input status (buttons are up or down?) Whenever you want you usually do it each frame.
This means that if your player is ninja and can kill a faster key than 60 fps, then it is possible that they < You can kill a key (or mouse button) by pressing em> between and you remember it. This is almost never an issue in practice. If this disturbs you, then the solution to this problem is to hook up Windows Message Pump and get keyboard up / down events. Normal gameplay is not really worth the effort, usually only once you capture every keystroke, then when the user is typing the text. So instead of capturing the key up / down events, you capture the character event ( (Of course, if you can participate only using the voting-based framework input material - go with it - it's very easy to implement and reduce platform-specific.) Only the above cases when you are detecting a specific key press (such as: Tap to fire this gun), as opposed to holding down key (Like: move this vehicle). Optional Interpretation Your question is that you are suggesting that one frame can come halfway through one frame - how do you eat it in a game with a discrete timing? Normally you do not worry about it, as 60 frames per second is strictly fast to calculate your game statement and to look smooth and continuous for a human being, Fast to accept input is fast. But what if you are not running at 60 fps? If you are running at 30 fps (as you can on any mobile platform), then it can input your input - especially analog - if you choose them at 60 fps, they feel very comfortable. The easiest way to do this is to WM_CHAR ), this means that you will not leave a keypress. But more importantly, it solves the problem that it offloads key-to-character translation in Windows - this allows to handle key-repeats, keyboard layouts, moved characters, etc. - Let's behave like a Windows application.
draw for each of the two
updates - if your update is not taxable on the CPU.
Comments
Post a Comment