DirectInput question....

Recommended Posts

I have directInput up and working in its own class. I am calling the function below from another class and everything is o.k.
// this is the function that detects keystrokes void
DXInput::DetectKeys(HWND hWnd){
static BYTE keystate[256];    // create a static storage for the key-states

dinkeyboard->Acquire();    // get access if we don't have it already

dinkeyboard->GetDeviceState(256, (LPVOID)keystate);    // fill keystate with values

if(keystate[DIK_ESCAPE] & 0x80)    // if the 'ESCAPE' key was pressed...
PostMessage(hWnd, WM_DESTROY, 0, 0);	// Shut her down
up
}


I now want to move the actual if statments that handle what to do if a key is pressed out of this function and into another class. So I am assuming I need to pass the actual keystate to another calling function from a diffrent class but I am not sure how to. Any have any advice. Regards Chad

Create an account

Register a new account

• Forum Statistics

• Total Topics
628333
• Total Posts
2982121

• 22
• 9
• 9
• 13
• 11