libcm is a C development framework with an emphasis on audio signal processing applications.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

cmKeyboard.h 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #ifndef cmKeyboard_h
  2. #define cmKeyboard_h
  3. enum
  4. {
  5. kInvalidKId,
  6. kAsciiKId,
  7. kLeftArrowKId,
  8. kRightArrowKId,
  9. kUpArrowKId,
  10. kDownArrowKId,
  11. kHomeKId,
  12. kEndKId,
  13. kPgUpKId,
  14. kPgDownKId,
  15. kInsertKId,
  16. kDeleteKId,
  17. };
  18. typedef struct
  19. {
  20. unsigned code;
  21. char ch;
  22. bool ctlFl;
  23. bool altFl;
  24. } cmKbRecd;
  25. // Set 'p' to NULL if the value of the key is not required.
  26. void cmKeyPress( cmKbRecd* p );
  27. // Return non-zero if a key is waiting to be read otherwise return 0.
  28. // Use getchar() to pick up the key.
  29. //
  30. // Example:
  31. // while( 1 )
  32. // {
  33. // if( cmIsKeyWaiting() == 0 )
  34. // usleep(20000);
  35. // else
  36. // {
  37. // char c = getchar();
  38. // switch(c)
  39. // {
  40. // ....
  41. // }
  42. // }
  43. //
  44. // }
  45. //
  46. // TODO: Note that this function turns off line-buffering on stdin.
  47. // It should be changed to a three function sequence.
  48. // bool org_state = cmSetStdinLineBuffering(false);
  49. // ....
  50. // cmIsKeyWaiting()
  51. // ....
  52. // cmSetStdinLineBuffering(org_state)
  53. int cmIsKeyWaiting();
  54. #endif