// Tom Plick // 29 July 2005 // controls.cpp // Read keypresses and change perspective based on them. #include #include "projector.h" extern Projector TheProjector; bool PollKeys(float timeDelta) { bool change = false; if (GetAsyncKeyState(VK_UP) & 0x8000f ){ TheProjector.addDistance(-8.0f * timeDelta); change = true; } if (GetAsyncKeyState(VK_DOWN) & 0x8000f ){ TheProjector.addDistance( 8.0f * timeDelta); change = true; } if (GetAsyncKeyState(VK_LEFT) & 0x8000f ){ TheProjector.addTheta(-1.0f * timeDelta); change = true; } if (GetAsyncKeyState(VK_RIGHT) & 0x8000f ){ TheProjector.addTheta( 1.0f * timeDelta); change = true; } // Page up if (GetAsyncKeyState(VK_PRIOR) & 0x8000f ){ TheProjector.addPhi(-1.0f * timeDelta); change = true; } // Page down if (GetAsyncKeyState(VK_NEXT) & 0x8000f ){ TheProjector.addPhi( 1.0f * timeDelta); change = true; } if (GetAsyncKeyState(VK_RETURN) & 0x8000f){ TheProjector.recenter(); change = true; } return change; }