Using DirectInput to get Keyboard Input

I am having a bit of trouble getting keyboard input to work with a program I am making. I need the "W" key to move a sprite I have made to a specific position. The problem I am having is that I do not know what proper code should be done to make it happen, as I have tried a large bit of different ideas I have seen scattered online to handle input but none of them have worked.

In the Update() of my DirectXFramework class I have this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//update keyboard device
m_dKeyboard->Acquire();
if(m_dKeyboard->GetDeviceState(sizeof(m_dKeyboardState), (LPVOID)&m_dKeyboardState) == DI_OK) {
		

	///////////////////////////
	//Keyboard Input Commands//
	///////////////////////////


	//W key pressed
	if(m_dKeyboardState[DIK_W] & 0x80 != 0) {
		D3DXMatrixTranslation(&testSprite[5].WorldMat, 200.0f, 200.0f, 0.0f);
		m_pD3DSpriteB[5]->SetTransform(&testSprite[5].WorldMat);
	}

	//A key pressed
	if(m_dKeyboardState[DIK_A] & 0x80) {

	}

	//S key pressed
	if(m_dKeyboardState[DIK_S] & 0x80) {

	}

	//D key pressed
	if(m_dKeyboardState[DIK_D] & 0x80) {

	}
}


I have tried using breakpoints to see if it works when I press "W" but no success so far. Is there something I am missing?
Last edited on
Solved this, following along here:

http://www.two-kings.de/tutorials/dinput/dinput02.html
Topic archived. No new replies allowed.