WASD Key Control

  1. In the OnKeyDown function, use a "switch-case" to detect whether the user presses W, S, Ad, D, keys, and draw a line segment upward, downward, leftward, rightward, respectively.
  2. You need to remember the current (x, y) coordinate, so that calculating the new coordinate and LineTo should be easy.
  3. The question is, where should you store the (x, y) coordinate? In OnKeyDown as static variables, or as data members of the View class?
WASD