func_input_keydown.rst 695 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. .. _func_input_keydown:
  2. =======
  3. KeyDown
  4. =======
  5. KeyDown -
  6. Description
  7. ===========
  8. .. code-block:: blitzmax
  9. KeyDown( key )
  10. Check for key state
  11. See the #{key codes} module for a list of valid keycodes.
  12. Parameters
  13. ==========
  14. Return Values
  15. =============
  16. #True if @key is currently down
  17. Examples
  18. ========
  19. .. code-block:: blitzmax
  20. ' keydown.bmx
  21. ' the following code draws a circle if the
  22. ' program detects the spacebar is pressed
  23. ' and exits when it detects the ESCAPE key has
  24. ' been pressed
  25. Graphics 640,480
  26. While Not KeyHit(KEY_ESCAPE)
  27. Cls
  28. If KeyDown(KEY_SPACE) DrawOval 0,0,640,480
  29. Flip
  30. Wend
  31. See Also
  32. ========