func_input_keyhit.rst 827 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. .. _func_input_keyhit:
  2. ======
  3. KeyHit
  4. ======
  5. KeyHit -
  6. Description
  7. ===========
  8. .. code-block:: blitzmax
  9. KeyHit( key )
  10. Check for key hit
  11. The returned value represents the number of the times @key has been hit since the last
  12. call to #KeyHit with the same @key.
  13. See the #{key codes} module for a list of valid key codes.
  14. Parameters
  15. ==========
  16. Return Values
  17. =============
  18. Number of times @key has been hit.
  19. Examples
  20. ========
  21. .. code-block:: blitzmax
  22. ' keyhit.bmx
  23. ' the following code draws a circle every time the
  24. ' program detects the spacebar has been pressed
  25. ' and exits when it detects the ESCAPE key has
  26. ' been pressed
  27. graphics 640,480
  28. while not keyhit(KEY_ESCAPE)
  29. cls
  30. if keyhit(KEY_SPACE) drawoval 0,0,640,480
  31. flip
  32. wend
  33. See Also
  34. ========