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.

69 lines
2.0KB

  1. /*
  2. * DISTRHO Cardinal Plugin
  3. * Copyright (C) 2021 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. #ifndef HEADLESS
  18. #include "OpenGL.hpp"
  19. #endif
  20. #include "nanovg.h"
  21. #ifdef HEADLESS
  22. struct NVGLUframebuffer;
  23. void nvgluBindFramebuffer(NVGLUframebuffer* fb) {}
  24. NVGLUframebuffer* nvgluCreateFramebuffer(NVGcontext* ctx, int w, int h, int imageFlags) { return nullptr; }
  25. void nvgluDeleteFramebuffer(NVGLUframebuffer* fb) {}
  26. #else
  27. # define NANOVG_GLES2_IMPLEMENTATION
  28. # define NANOVG_FBO_VALID 1
  29. # include "nanovg_gl.h"
  30. # include "nanovg_gl_utils.h"
  31. #endif
  32. #if defined(__GNUC__) && (__GNUC__ >= 6)
  33. # pragma GCC diagnostic push
  34. # pragma GCC diagnostic ignored "-Wmisleading-indentation"
  35. # pragma GCC diagnostic ignored "-Wshift-negative-value"
  36. #endif
  37. #include "nanovg.c"
  38. #if defined(__GNUC__) && (__GNUC__ >= 6)
  39. # pragma GCC diagnostic pop
  40. #endif
  41. #define GLFWAPI
  42. extern "C" {
  43. typedef struct GLFWcursor GLFWcursor;
  44. typedef struct GLFWwindow GLFWwindow;
  45. GLFWAPI const char* glfwGetClipboardString(GLFWwindow*) { return nullptr; }
  46. GLFWAPI void glfwSetClipboardString(GLFWwindow*, const char*) {}
  47. GLFWAPI GLFWcursor* glfwCreateStandardCursor(int) { return nullptr; }
  48. GLFWAPI void glfwSetCursor(GLFWwindow*, GLFWcursor*) {}
  49. GLFWAPI const char* glfwGetKeyName(int, int) { return nullptr; }
  50. GLFWAPI int glfwGetKeyScancode(int) { return 0; }
  51. GLFWAPI double glfwGetTime(void) { return 0.0; }
  52. }
  53. #ifndef HEADLESS
  54. # define STB_IMAGE_WRITE_IMPLEMENTATION
  55. # include "../src/Rack/dep/glfw/deps/stb_image_write.h"
  56. #endif