Skip To Content

Athabasca University

2.2. Getting Input from the Player

Learning Objectives

When you have finished section 2.2, you should be able to:

  1. Handle keyboard input.
  2. Detect key presses.
  3. Deal with buffered keyboard input.
  4. Handle mouse input.
  5. Read the mouse position.
  6. Work with relative mouse motion.
  7. Handle joystick input.
  8. Handle joystick controller movement.
  9. Handle joystick button presses.

Required Tasks

  1. Study Chapter 5, Getting Input from the Player, in the eTextbook.
  2. Carefully study each code fragment discussed in Chapter 5.
  3. Complete the Chapter 5 quiz, and check your answers in Appendix A.

Files (defense, keytest, mousewheel, positionmouse, scanjoystick, stargate, testjoystick)

Optional Tasks

  1. Type the KeyTest program into your IDE. Build and run the program.
  2. Type the source code for the Strategic Defense Game into your IDE and build it.

Updated May 24 2016 by FST Course Production