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.

91 lines
2.5KB

  1. /*
  2. * DISTRHO Plugin Framework (DPF)
  3. * Copyright (C) 2012-2018 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 "StandaloneWindow.hpp"
  19. #include "widgets/ExampleColorWidget.hpp"
  20. #include "widgets/ExampleImagesWidget.hpp"
  21. #include "widgets/ExampleRectanglesWidget.hpp"
  22. #include "widgets/ExampleShapesWidget.hpp"
  23. #include "widgets/ExampleTextWidget.hpp"
  24. #include "widgets/NanoPerfWidget.hpp"
  25. // ------------------------------------------------------
  26. // Images
  27. #include "demo_res/DemoArtwork.cpp"
  28. #include "images_res/CatPics.cpp"
  29. // ------------------------------------------------------
  30. // Single Widget Window
  31. static int gWindowCount = 0;
  32. template<class WIG>
  33. class SingleWidgetWindow : public Window
  34. {
  35. public:
  36. SingleWidgetWindow(Application& app)
  37. : Window(app),
  38. fWidget(*this)
  39. {
  40. const String title = "demo-multi-" + String(++gWindowCount);
  41. setSize(fWidget.getSize());
  42. setTitle(title);
  43. show();
  44. }
  45. protected:
  46. void onReshape(uint width, uint height) override
  47. {
  48. fWidget.setSize(width, height);
  49. Window::onReshape(width, height);
  50. }
  51. void onClose() override
  52. {
  53. Window::onClose();
  54. if (--gWindowCount == 0)
  55. getApp().quit();
  56. }
  57. private:
  58. WIG fWidget;
  59. };
  60. // ------------------------------------------------------
  61. // main entry point
  62. int main()
  63. {
  64. Application app;
  65. SingleWidgetWindow<ExampleColorWidget> wColor(app);
  66. SingleWidgetWindow<ExampleImagesWidget> wImages(app);
  67. SingleWidgetWindow<ExampleRectanglesWidget> wRects(app);
  68. SingleWidgetWindow<ExampleShapesWidget> wShapes(app);
  69. SingleWidgetWindow<ExampleTextWidget> wText(app);
  70. app.exec();
  71. return 0;
  72. }
  73. // ------------------------------------------------------