cocoa_key_to_anttweakbar_key.cpp 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
  4. //
  5. // This Source Code Form is subject to the terms of the Mozilla Public License
  6. // v. 2.0. If a copy of the MPL was not distributed with this file, You can
  7. // obtain one at http://mozilla.org/MPL/2.0/.
  8. #include "cocoa_key_to_anttweakbar_key.h"
  9. #ifndef IGL_NO_ANTTWEAKBAR
  10. #include <AntTweakBar.h>
  11. IGL_INLINE int igl::cocoa_key_to_anttweakbar_key(int key)
  12. {
  13. // I've left commented the AntTweakBar key codes that correspond to keys I
  14. // don't have on my keyboard. Please fill this in if you have those keys
  15. switch(key)
  16. {
  17. case 127:
  18. return TW_KEY_BACKSPACE;
  19. case 9:
  20. return TW_KEY_TAB;
  21. //TW_KEY_CLEAR = 0x0c,
  22. case 3://ENTER
  23. case 13:
  24. return TW_KEY_RETURN;
  25. case 27:
  26. return TW_KEY_ESCAPE;
  27. case 32:
  28. return TW_KEY_SPACE;
  29. // IN A GLUT APP 40 is (
  30. //case 40:
  31. case 63272:
  32. return TW_KEY_DELETE;
  33. case 63232:
  34. return TW_KEY_UP;
  35. case 63233:
  36. return TW_KEY_DOWN;
  37. case 63235:
  38. return TW_KEY_RIGHT;
  39. case 63234:
  40. return TW_KEY_LEFT;
  41. //TW_KEY_INSERT,
  42. //TW_KEY_HOME,
  43. //TW_KEY_END,
  44. //TW_KEY_PAGE_UP,
  45. //TW_KEY_PAGE_DOWN,
  46. case 63236:
  47. return TW_KEY_F1;
  48. case 63237:
  49. return TW_KEY_F2;
  50. case 63238:
  51. return TW_KEY_F3;
  52. case 63239:
  53. return TW_KEY_F4;
  54. case 63240:
  55. return TW_KEY_F5;
  56. case 63241:
  57. return TW_KEY_F6;
  58. case 63242:
  59. return TW_KEY_F7;
  60. case 63243:
  61. return TW_KEY_F8;
  62. case 63244:
  63. return TW_KEY_F9;
  64. case 63245:
  65. return TW_KEY_F10;
  66. case 63246:
  67. return TW_KEY_F11;
  68. case 63247:
  69. return TW_KEY_F12;
  70. case 63248:
  71. return TW_KEY_F13;
  72. case 63249:
  73. return TW_KEY_F14;
  74. case 63250:
  75. return TW_KEY_F15;
  76. default:
  77. break;
  78. }
  79. return key;
  80. }
  81. #endif