If you're talking about an episode precisely give us the number so we can talk about the same thing.
When you press and release a key, windows will add messages in the
message queue (first in, first out):
WN_KEYDOWN,
WM_KEYUP,
WM_SYSKEYDOWN and
WM_SYSKEYUP.
When you process key messages, you use either
PeekMessage or
GetMessage. Those functions will give you the next available message in the queue until there is no more message in the queue. If you press the same key several times there will be several key up/down messages in the queue for that key. If you keep calling the PeekMessage or GetMessage function, you'll get several messages and so you can count the transition count.
In pseudo code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 | main( ){
while (running) {
// Start input
while (message in the queue){
get the next message
update the transition count
}
// End input
update( )
render( )
}
}
|