Skip to main content
gamedev.net
🔒 Locked

DirectX input issues

Started by h-bar 0 replies 750+ views
Original Post
h-bar
h-bar
Hi, I've searched for a long time to find out more information about this particular issue I'm having with keyboard input in directx. I hope I haven't missed a former thread about this. If I have, please direct me and accept my apologies. The problem is this. When a key is held down for a few seconds, there is a period shortly afterwards that prevents other input events from happening immediately, although the initial key press responds correctly. The length of this period depends on the the length of time the key was held down. As an example, the 'w' key is pressed for 10 seconds and released and the response to both actions was immediate. I next attempt to use the mouse wheel for input, however it takes a few seconds for a response to actually happen. Also, the subsequent input of the mouse wheel is being remebered, so that in just few seconds all the actions will take place. I'm using, LPDIRECTINPUTDEVICE8 for both keyboard and mouse input, with the following intialization, din->CreateDevice(GUID_SysKeyboard, &dinkeyboard, NULL); din->CreateDevice(GUID_SysMouse, &dinmouse, NULL); dinkeyboard->SetDataFormat(&c_dfDIKeyboard); dinmouse->SetDataFormat(&c_dfDIMouse); dinkeyboard->SetCooperativeLevel(hWnd, DISCL_NONEXCLUSIVE | DISCL_FOREGROUND); dinmouse->SetCooperativeLevel(hWnd, DISCL_NONEXCLUSIVE | DISCL_FOREGROUND); For my mouse and keyboard functions, I acquire input with, dinmouse->GetDeviceState(sizeof(DIMOUSESTATE), (LPVOID)&mousestate); dinkeyboard->GetDeviceState(256, (LPVOID)keystate); additionally, I use windows events for some keys to, since they don't immediately repeat. LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { case WM_CHAR: switch (wParam) }, for example. After using DX input, the following are affected and require some time before they 'activate': DX mousewheel, windows keys, any type of event that is initiated by clicking on the window. As you can tell, I'm kind of a novice at this. My guess is that I'm flooding a buffer and it takes some time to empty out. Any advice is appreciated, h-bar btw, the program I'm referring to can be found at photoforms.com. It's essentially a tool to turn images into 3D objects. It requires a stereoscopic interface for proper usage.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.