PDA

View Full Version : Simple question about DirectInput8?



FusionWolf
23-01-2005, 09:58 PM
Hi,

If I set DirectInput cooperativelevel with DISCL_BACKGROUND and DISCL_NONEXCLUSIVE flags. Everything works perfect BUT!

If I'm running in windowed mode and DISCL_BACKGROUND is implemented, then application receives input even it's not active. And when my window is not active I'm not updating the scene. So this causes a little problem.

If I set cooperative flag DISCL_FOREGROUND among with DISCL_NONEXCLUSIVE then everything works fine until window loses its focus. And when it's activated again, DirectInput doesn't get keyboard state anymore?!?

I'm aware that GetDeviceState returns DIERR_INPUTLOST if it cannot get device state, but even if I try to re-acquire device it doesn't help, UNTIL I set cooperativelevel again with DISCL_BACKGROUND flag, which gaves me same result if I use it in the first place (when initializing).

So, what to do? I tried to set window to topmost before re-acquiring, but that didn't help either. Please, help ObiWan Kenobi. You are my only hope. :)

tux
23-01-2005, 10:07 PM
are you re aquiring the device?

FusionWolf
23-01-2005, 10:55 PM
are you re aquiring the device?

Yes I was acquiring it ONCE per one main loop cycle. I Mean that in main loop I called GetDeviceState and if it gave "inputlost" result I called device.acquire, but that didn't help.

Now I got it to work. I found DI tutorial from DX SDK and from there I saw that device.acquire is called in a while loop when input is lost. So I recoded my application so and put that acquire in a while loop and now it works perfectly.

Thanks for your answer anyway. ;)

tux
24-01-2005, 12:19 PM
:)