   Two direct input devices
  Is there harm in creating two directInput devices for the same keyboard? Or could someone show me how to do the following:Here is my KeyStateBuffer:charKeyStateBuffer[256];How can I pass the address of this buffer once so that as winMain updates the buffer the gameEngines will always have an updated KeyStateBuffer. thanks in advance[edited by - dapeos on February 13, 2004 3:45:13 AM]
  Depends on what you mean by harm. Just remember that Acquire() will probably fail on the second device if the first has already Acquire()d the keyboard, assuming that a second keyboard device can even be instantiated. ;  I thought so too, but it works it just seems like sloppy programing and I would like to know how to do what I stated above.;  You could wrap all your DI stuff in a class, with initialization, acquire/unacquire as methods, an update method that you call every frame. The DIK8 and DIM8 interfaces would be private, but the keybuffer[] could be a public property so anyone could query the results.You should probably make functions (methods) for keydown/keypressed that do a if ((keybuffer[DIK_ESCAPE]) & 0x80 = 0x80) etc. to make your code more readable.;  Thanks alot for the advice, I already have DI in a class just as you stated but for some reason neverthought of putting my Keystatbuffer in the DI class. I always passed it in to my cDInput.Read((void*) buffer). that seems like the best solution thanks.  