Original Post
I have implemented a Direct Input class almost identical to this which is described in "Programming RPGs with DirectX". I have a question. My game consists of two states. I want to change from menu state to game state by pressing the LEFT arrow key. I also want to change from game state to menu state by pressing RIGHT arrow key. I use this: if(m_Input.KeyStateBuffer[DIK_LEFT]&&0x80) { ChangeState(GAMESTATE); } when I'm on menu state and if(m_Input.KeyStateBuffer[DIK_RIGHT]&&0x80) { ChangeState(MENUSTATE); } when I'm on game state. m_Input is my Direct Input class. The fact is that the states change continually without pressing any key when the program starts. I assume that the if statement is always true in both cases and that's why the states change by themselves. Any idea what might be wrong? Thanks