DirectX's input system is pretty tightly bound to the render cycle, and there's a heck of a lot of operating system between you and the switches in the USB gamepad.Īre you sure about that? I can possibly see a state transition going that fast here and there, but you do realize it would take a sustained 70 presses per second to see a button down every 14ms? Sorry but that is not physically possible, although perhaps you can induce it here and there with some crazy all-knuckles button-mashing, and maybe there is even some bounce in the hardware itself. This wasn't to detect button-mashing, but to get crisp intraframe timing for fighting games where it mattered (because you were allowed to queue up inputs "before" a critical trigger frame in the animation, and the animation rate might not be as stable as we like, so we needed to distinguish whether you'd hit the button before the frame boundary or on it). You'd save that off somewhere in main memory, and then when your main game loop ran it would have a history of 4 or 8 or however many samples of input data at a consistent time interval. On these system the controller appeared as memory-mapped I/O, so you'd simply load a word out of a particular memory location and that would have the position of the joystick's X-axis at that moment. By "a timer-driven thread" I mean there was a hardware timer that poked an interrupt that caused a particular function to get called in realtime. On Nintendo and Sony hardware we sometimes polled the input at a higher rate than we drew frames use a timer-driven thread to look at the controller I/O at 120hz, for example, even when we were rendering at 30hz. (I have only recently started using GLFW, so please correct me if I am wrong, as having either of those would solve the problem.)Īlthough I am asking about GLFW, answers related to any library/engine/language are welcome. Also, it does not appear to be possible to enable "sticky keys" for a joystick. I am currently using GLFW to make a game, and I've noticed that keyboard and mouse have callback functions, while joysticks do not. Specifically, I am asking about GLFW's joystick input capabilities. I was not, however, able to do this while holding the joystick normally, and the press-release cycle would have to start at almost the exact time the frame starts. While testing, I was able to press and release a button within about 14 or 15 milliseconds (over 1 click/frame). How do programmers usually handle this situation? Is it even necessary to handle it? Is it usually possible for the player to press and release a button within a single frame, so that the game engine doesn't have time to detect it?
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |