12.1. How the critters listen to the user input
The cController utility class
The Microsoft void CView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) method is triggered whenever a key is pressed. The nFlags argument is a collection of bitflags designed to tell you whether the Ctrl, Alt, and/or Shift keys are down, and whether this is a repeated typematic keypress. The nRepCnt is also supposed to hold the number of repeated typematic messages that a key press has generated, where ‘typematic’ refers to the feature that has most keys trigger additional OnKeyDown messages if you continue to hold them down. In point of fact, the nFlags and nRepCnt arguments don’t reliably behave as Microsoft’s documentation says they do, so we work around them, ...
Get Software Engineering and Computer Games now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.