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.

198 lines
3.2KB

  1. /*
  2. * DISTRHO Cardinal Plugin
  3. * Copyright (C) 2021-2023 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. /**
  18. * This file is an edited version of VCVRack's Window.cpp
  19. * Copyright (C) 2016-2023 VCV.
  20. *
  21. * This program is free software: you can redistribute it and/or
  22. * modify it under the terms of the GNU General Public License as
  23. * published by the Free Software Foundation; either version 3 of
  24. * the License, or (at your option) any later version.
  25. */
  26. #include <map>
  27. #include <queue>
  28. #include <thread>
  29. #include <window/Window.hpp>
  30. #include <asset.hpp>
  31. #include <widget/Widget.hpp>
  32. #include <app/Scene.hpp>
  33. #include <context.hpp>
  34. #include <patch.hpp>
  35. #include <settings.hpp>
  36. #include <system.hpp>
  37. #ifdef NDEBUG
  38. # undef DEBUG
  39. #endif
  40. namespace rack {
  41. namespace window {
  42. static const math::Vec minWindowSize = math::Vec(1228, 666);
  43. void Font::loadFile(const std::string& filename, NVGcontext* vg) {
  44. }
  45. Font::~Font() {
  46. }
  47. std::shared_ptr<Font> Font::load(const std::string& filename) {
  48. return APP->window->loadFont(filename);
  49. }
  50. void Image::loadFile(const std::string& filename, NVGcontext* vg) {
  51. }
  52. Image::~Image() {
  53. }
  54. std::shared_ptr<Image> Image::load(const std::string& filename) {
  55. return APP->window->loadImage(filename);
  56. }
  57. Window::Window() {
  58. windowRatio = minWindowSize.x / minWindowSize.y;
  59. widget::Widget::ContextCreateEvent e;
  60. APP->scene->onContextCreate(e);
  61. }
  62. Window::~Window() {
  63. if (APP->scene) {
  64. widget::Widget::ContextDestroyEvent e;
  65. APP->scene->onContextDestroy(e);
  66. }
  67. }
  68. math::Vec Window::getSize() {
  69. return minWindowSize;
  70. }
  71. void Window::setSize(math::Vec) {
  72. }
  73. void Window::run() {
  74. }
  75. void Window::step() {
  76. }
  77. void Window::screenshot(const std::string&) {
  78. }
  79. void Window::screenshotModules(const std::string&, float) {
  80. }
  81. void Window::close() {
  82. }
  83. void Window::cursorLock() {
  84. }
  85. void Window::cursorUnlock() {
  86. }
  87. bool Window::isCursorLocked() {
  88. return false;
  89. }
  90. int Window::getMods() {
  91. return 0;
  92. }
  93. void Window::setFullScreen(bool) {
  94. }
  95. bool Window::isFullScreen() {
  96. return false;
  97. }
  98. double Window::getMonitorRefreshRate() {
  99. return 60;
  100. }
  101. double Window::getFrameTime() {
  102. return 0;
  103. }
  104. double Window::getLastFrameDuration() {
  105. return 0.0;
  106. }
  107. double Window::getFrameDurationRemaining() {
  108. return 0.0;
  109. }
  110. std::shared_ptr<Font> Window::loadFont(const std::string& filename) {
  111. return std::make_shared<Font>();
  112. }
  113. std::shared_ptr<Image> Window::loadImage(const std::string& filename) {
  114. return std::make_shared<Image>();
  115. }
  116. bool& Window::fbDirtyOnSubpixelChange() {
  117. static bool _fbDirtyOnSubpixelChange;
  118. return _fbDirtyOnSubpixelChange;
  119. }
  120. int& Window::fbCount() {
  121. static int _fbCount;
  122. return _fbCount;
  123. }
  124. void generateScreenshot() {
  125. }
  126. } // namespace window
  127. } // namespace rack