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.

79 lines
2.2KB

  1. /*
  2. * DISTRHO Cardinal Plugin
  3. * Copyright (C) 2021-2022 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation; either version 3 of
  8. * the License, or any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * For a full copy of the GNU General Public License see the LICENSE file.
  16. */
  17. #include "DistrhoPluginInfo.h"
  18. #ifndef DISTRHO_PLUGIN_WANT_DIRECT_ACCESS
  19. # error wrong build
  20. #endif
  21. #if ! DISTRHO_PLUGIN_WANT_DIRECT_ACCESS
  22. # define HEADLESS
  23. #endif
  24. #ifndef HEADLESS
  25. # include "OpenGL.hpp"
  26. #endif
  27. #include "nanovg.h"
  28. #ifdef HEADLESS
  29. struct NVGLUframebuffer;
  30. void nvgluBindFramebuffer(NVGLUframebuffer* fb) {}
  31. NVGLUframebuffer* nvgluCreateFramebuffer(NVGcontext* ctx, int w, int h, int imageFlags) { return nullptr; }
  32. void nvgluDeleteFramebuffer(NVGLUframebuffer* fb) {}
  33. #else
  34. # define NANOVG_GLES2_IMPLEMENTATION
  35. # define NANOVG_FBO_VALID 1
  36. # include "nanovg_gl.h"
  37. # include "nanovg_gl_utils.h"
  38. #endif
  39. #if defined(__GNUC__) && (__GNUC__ >= 6)
  40. # pragma GCC diagnostic push
  41. # pragma GCC diagnostic ignored "-Wmisleading-indentation"
  42. # pragma GCC diagnostic ignored "-Wshift-negative-value"
  43. #endif
  44. #include "nanovg.c"
  45. #if defined(__GNUC__) && (__GNUC__ >= 6)
  46. # pragma GCC diagnostic pop
  47. #endif
  48. #define GLFWAPI
  49. extern "C" {
  50. typedef struct GLFWcursor GLFWcursor;
  51. typedef struct GLFWwindow GLFWwindow;
  52. GLFWAPI const char* glfwGetClipboardString(GLFWwindow*) { return nullptr; }
  53. GLFWAPI void glfwSetClipboardString(GLFWwindow*, const char*) {}
  54. GLFWAPI GLFWcursor* glfwCreateStandardCursor(int) { return nullptr; }
  55. GLFWAPI void glfwSetCursor(GLFWwindow*, GLFWcursor*) {}
  56. GLFWAPI const char* glfwGetKeyName(int, int) { return nullptr; }
  57. GLFWAPI int glfwGetKeyScancode(int) { return 0; }
  58. GLFWAPI double glfwGetTime(void) { return 0.0; }
  59. }
  60. #ifndef HEADLESS
  61. # define STB_IMAGE_WRITE_IMPLEMENTATION
  62. # include "../src/Rack/dep/glfw/deps/stb_image_write.h"
  63. #endif