DPF OpenGL examples
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.

117 lines
2.4KB

  1. /*
  2. * DISTRHO Plugin Framework (DPF)
  3. * Copyright (C) 2012-2015 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. // ------------------------------------------------------
  17. // DGL Stuff
  18. #include "ntk/NtkApp.hpp"
  19. #include "ntk/NtkWidget.hpp"
  20. #include "ntk/NtkWindow.hpp"
  21. #include <FL/Fl_Button.H>
  22. // ------------------------------------------------------
  23. #define DISTRHO_PLUGIN_TARGET_DSSI
  24. #include "DistrhoPlugin.hpp"
  25. #include "DistrhoUI.hpp"
  26. //#include "DistrhoPluginMain.cpp"
  27. #include "DistrhoUIMain.cpp"
  28. START_NAMESPACE_DISTRHO
  29. using DGL::NtkWindow;
  30. // ------------------------------------------------------
  31. // NTK UI Test
  32. class NtkUiTest : public UI
  33. {
  34. public:
  35. NtkUiTest()
  36. : UI(),
  37. but1(10,10,140,25,"Button 1"),
  38. but2(10,40,140,25,"Button 2")
  39. {
  40. box(FL_BORDER_BOX);
  41. color(46);
  42. add(but1);
  43. add(but2);
  44. end();
  45. }
  46. ~NtkUiTest()
  47. {
  48. }
  49. protected:
  50. uint d_getWidth() const noexcept override
  51. {
  52. return 300;
  53. }
  54. uint d_getHeight() const noexcept override
  55. {
  56. return 300;
  57. }
  58. void d_parameterChanged(uint32_t, float) override
  59. {
  60. }
  61. private:
  62. Fl_Button but1, but2;
  63. };
  64. // ------------------------------------------------------
  65. Plugin* createPlugin()
  66. {
  67. return nullptr;
  68. }
  69. UI* createUI()
  70. {
  71. return new NtkUiTest();
  72. }
  73. // ------------------------------------------------------
  74. END_NAMESPACE_DISTRHO
  75. // ------------------------------------------------------
  76. int main2()
  77. {
  78. USE_NAMESPACE_DISTRHO;
  79. USE_NAMESPACE_DGL;
  80. NtkApp app;
  81. NtkWindow window(app);
  82. window.setSize(300, 300);
  83. window.setTitle("NTK UI Test");
  84. window.show();
  85. app.exec();
  86. return 0;
  87. }
  88. // ------------------------------------------------------