Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Base.hpp 3.2KB

11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /*
  2. * DISTRHO Plugin Toolkit (DPT)
  3. * Copyright (C) 2012-2013 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for any purpose with
  6. * or without fee is hereby granted, provided that the above copyright notice and this
  7. * permission notice appear in all copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
  10. * TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
  11. * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  12. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
  13. * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  14. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #ifndef DGL_BASE_HPP_INCLUDED
  17. #define DGL_BASE_HPP_INCLUDED
  18. #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
  19. # define DGL_OS_WINDOWS 1
  20. #elif defined(__APPLE__)
  21. # define DGL_OS_MAC 1
  22. #elif defined(__HAIKU__)
  23. # define DGL_OS_HAIKU 1
  24. #elif defined(__linux__)
  25. # define DGL_OS_LINUX 1
  26. #endif
  27. #if defined(HAVE_CPP11_SUPPORT)
  28. # define PROPER_CPP11_SUPPORT
  29. #elif defined(__GNUC__) && (__cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__))
  30. # if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405
  31. # define PROPER_CPP11_SUPPORT
  32. # if (__GNUC__ * 100 + __GNUC_MINOR__) < 407
  33. # define override // gcc4.7+ only
  34. # endif
  35. # endif
  36. #endif
  37. #ifndef PROPER_CPP11_SUPPORT
  38. # ifndef __clang__
  39. # define noexcept throw()
  40. # endif
  41. # define override
  42. # define nullptr (0)
  43. #endif
  44. #ifndef DGL_NAMESPACE
  45. # define DGL_NAMESPACE DGL
  46. #endif
  47. #define START_NAMESPACE_DGL namespace DGL_NAMESPACE {
  48. #define END_NAMESPACE_DGL }
  49. #define USE_NAMESPACE_DGL using namespace DGL_NAMESPACE;
  50. #if DGL_OS_MAC
  51. # include <OpenGL/gl.h>
  52. #else
  53. # include <GL/gl.h>
  54. #endif
  55. #if defined(GL_BGR_EXT) && ! defined(GL_BGR)
  56. # define GL_BGR GL_BGR_EXT
  57. #endif
  58. #if defined(GL_BGRA_EXT) && ! defined(GL_BGRA)
  59. # define GL_BGRA GL_BGRA_EXT
  60. #endif
  61. #ifndef GL_CLAMP_TO_BORDER
  62. # define GL_CLAMP_TO_BORDER 0x812D
  63. #endif
  64. START_NAMESPACE_DGL
  65. // -----------------------------------------------------------------------
  66. /*
  67. * Convenience symbols for ASCII control characters.
  68. */
  69. enum Char {
  70. CHAR_BACKSPACE = 0x08,
  71. CHAR_ESCAPE = 0x1B,
  72. CHAR_DELETE = 0x7F
  73. };
  74. /*
  75. * Special (non-Unicode) keyboard keys.
  76. */
  77. enum Key {
  78. KEY_F1 = 1,
  79. KEY_F2,
  80. KEY_F3,
  81. KEY_F4,
  82. KEY_F5,
  83. KEY_F6,
  84. KEY_F7,
  85. KEY_F8,
  86. KEY_F9,
  87. KEY_F10,
  88. KEY_F11,
  89. KEY_F12,
  90. KEY_LEFT,
  91. KEY_UP,
  92. KEY_RIGHT,
  93. KEY_DOWN,
  94. KEY_PAGE_UP,
  95. KEY_PAGE_DOWN,
  96. KEY_HOME,
  97. KEY_END,
  98. KEY_INSERT,
  99. KEY_SHIFT,
  100. KEY_CTRL,
  101. KEY_ALT,
  102. KEY_SUPER
  103. };
  104. /*
  105. * Keyboard modifier flags.
  106. */
  107. enum Modifier {
  108. MODIFIER_SHIFT = 1 << 0, /**< Shift key */
  109. MODIFIER_CTRL = 1 << 1, /**< Control key */
  110. MODIFIER_ALT = 1 << 2, /**< Alt/Option key */
  111. MODIFIER_SUPER = 1 << 3 /**< Mod4/Command/Windows key */
  112. };
  113. /*
  114. * Cross-platform sleep function.
  115. */
  116. void sleep(unsigned int secs);
  117. /*
  118. * Cross-platform msleep function.
  119. */
  120. void msleep(unsigned int msecs);
  121. // -----------------------------------------------------------------------
  122. END_NAMESPACE_DGL
  123. #endif // DGL_BASE_HPP_INCLUDED