Game Development Reference
In-Depth Information
//
// Update: Update the camera.
//
if( ::GetAsyncKeyState('W') & 0x8000f )
TheCamera.walk(4.0f * timeDelta);
if( ::GetAsyncKeyState('S') & 0x8000f )
TheCamera.walk(-4.0f * timeDelta);
if( ::GetAsyncKeyState('A') & 0x8000f )
TheCamera.strafe(-4.0f * timeDelta);
if( ::GetAsyncKeyState('D') & 0x8000f )
TheCamera.strafe(4.0f * timeDelta);
if( ::GetAsyncKeyState('R') & 0x8000f )
TheCamera.fly(4.0f * timeDelta);
if( ::GetAsyncKeyState('F') & 0x8000f )
TheCamera.fly(-4.0f * timeDelta);
if( ::GetAsyncKeyState(VK_UP) & 0x8000f )
TheCamera.pitch(1.0f * timeDelta);
if( ::GetAsyncKeyState(VK_DOWN) & 0x8000f )
TheCamera.pitch(-1.0f * timeDelta);
if( ::GetAsyncKeyState(VK_LEFT) & 0x8000f )
TheCamera.yaw(-1.0f * timeDelta);
if( ::GetAsyncKeyState(VK_RIGHT) & 0x8000f )
TheCamera.yaw(1.0f * timeDelta);
if( ::GetAsyncKeyState('N') & 0x8000f )
TheCamera.roll(1.0f * timeDelta);
if( ::GetAsyncKeyState('M') & 0x8000f )
TheCamera.roll(-1.0f * timeDelta);
// Update the view matrix representing the cameras
// new position/orientation.
D3DXMATRIX V;
TheCamera.getViewMatrix(&V);
Device->SetTransform(D3DTS_VIEW, &V);
//
// Render
//
Device->Clear(0, 0,
D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER,
0x00000000, 1.0f, 0);
Device->BeginScene();
d3d::DrawBasicScene(Device, 1.0f);
Search WWH ::




Custom Search