• Advertisement
Sign in to follow this  

DirectInput question....

This topic is 3947 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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

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

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement