Implement keyboard event functions (fixes #60)

New functions include KeyInit(), KeyPoll(),
KeyIsDown(), KeyIsPressed(), KeyIsReleased()
and KeyGetPressed(). Callers do not need to
track cmd/prevcmd to detect new key presses.