O'Reilly logo

Software Engineering and Computer Games by Rudy Rucker

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required