Sign in to follow this  
chadsxe

DirectInput question....

Recommended Posts

chadsxe    146
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this