|Project:||The Open Toolkit library|
It's a nice (not to say important feature) to detect the difference between a new key press (just pressed key) and a constant key press (key down for several frames) events. You can have a look here to know how I handle the case. The main idea is to poll keyboard state at each frame and store the previous / current states in an array. To detect a constant key press, both value in the array are true, and to detect a new keypress, only the current array is true, and the previous is false.
You can extented this technique for more input device (mouse and gamepad).