Anyways, you think this code will do for storing 2 keyboardstates?
poll(){ // Poll keyboard. HRESULT hr = mKeyboard->GetDeviceState(sizeof(mLastKeyboardState), (void**)&mKeyboardState); HRESULT hr = mKeyboard->GetDeviceState(sizeof(mKeyboardState), (void**)&mKeyboardState); if( FAILED(hr) ) { // Keyboard lost, zero out keyboard data structure. ZeroMemory(mKeyboardState, sizeof(mKeyboardState)); // Try to acquire for next time we poll. hr = mKeyboard->Acquire(); }
And then in Menu::keyPressed(char key)
I check if mLastKeyboardState[key] is false and mKeyboardState[key] is true.
I'm not sure how the poll() function is suppose to look like, dunno if that I posted is valid. Think it is?