2.2. Getting Input from the Player
Learning Objectives
When you have finished section 2.2, you should be able to:
- Handle keyboard input.
- Detect key presses.
- Deal with buffered keyboard input.
- Handle mouse input.
- Read the mouse position.
- Work with relative mouse motion.
- Handle joystick input.
- Handle joystick controller movement.
- Handle joystick button presses.
Required Tasks
- Study Chapter 5, Getting Input from the Player, in the eTextbook.
- Carefully study each code fragment discussed in Chapter 5.
- Complete the Chapter 5 quiz, and check your answers in Appendix A.
Files (defense, keytest, mousewheel, positionmouse, scanjoystick, stargate, testjoystick)
Optional Tasks
- Type the KeyTest program into your IDE. Build and run the program.
- Type the source code for the Strategic Defense Game into your IDE and build it.