Discussion:
This program builds on the previous tutorial by adding
simple keyboard interaction, including both special key functions
(arrows, page up/down) and regular key functions (W for wireframe
toggle, Q for quit). Case statements allow us to quickly write code
segments to respond to any input. We also add a data structure that
keeps track of the rotation of the object on the three axes.
Sample code:
Click here to see the sample code: keyboard.c
Executable example:
Click here for a running demo: keyboard.exe
|