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.

94 lines
1.9KB

  1. /*
  2. * Carla Tests
  3. * Copyright (C) 2013 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 2 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 GPL.txt file
  16. */
  17. #include "dgl/App.hpp"
  18. #include "dgl/Image.hpp"
  19. #include "dgl/Widget.hpp"
  20. #include "dgl/Window.hpp"
  21. #include "DGL_Artwork.hpp"
  22. USE_NAMESPACE_DGL;
  23. class StandaloneWindow
  24. {
  25. public:
  26. StandaloneWindow()
  27. : fApp(),
  28. fWindow(&fApp)
  29. {
  30. }
  31. App* getApp()
  32. {
  33. return &fApp;
  34. }
  35. Window* getWindow()
  36. {
  37. return &fWindow;
  38. }
  39. void exec()
  40. {
  41. fWindow.show();
  42. fApp.exec();
  43. }
  44. private:
  45. App fApp;
  46. Window fWindow;
  47. };
  48. class MyWidget : public Widget
  49. {
  50. public:
  51. MyWidget(StandaloneWindow* win)
  52. : Widget(win->getWindow()),
  53. fWindow(win->getWindow())
  54. {
  55. {
  56. using namespace DGL_Artwork;
  57. fImage.loadFromMemory(start_here_kxstudioData,
  58. Size<int>(start_here_kxstudioWidth, start_here_kxstudioHeight),
  59. GL_BGRA, GL_UNSIGNED_BYTE);
  60. }
  61. fWindow->setSize(fImage.getWidth(), fImage.getHeight());
  62. fWindow->setWindowTitle("DGL Test");
  63. }
  64. protected:
  65. void onDisplay() override
  66. {
  67. fImage.draw();
  68. }
  69. private:
  70. Window* const fWindow;
  71. Image fImage;
  72. };
  73. int main()
  74. {
  75. StandaloneWindow win;
  76. MyWidget widget(&win);
  77. win.exec();
  78. return 0;
  79. }