The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
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.

99 lines
2.5KB

  1. /*
  2. ==============================================================================
  3. This file was auto-generated!
  4. ==============================================================================
  5. */
  6. #ifndef MAINCOMPONENT_H_INCLUDED
  7. #define MAINCOMPONENT_H_INCLUDED
  8. #include "../JuceLibraryCode/JuceHeader.h"
  9. //==============================================================================
  10. /*
  11. This component lives inside our window, and this is where you should put all
  12. your controls and content.
  13. */
  14. class MainContentComponent : public AnimatedAppComponent
  15. {
  16. public:
  17. //==============================================================================
  18. MainContentComponent()
  19. {
  20. setSize (500, 400);
  21. setFramesPerSecond (60);
  22. }
  23. ~MainContentComponent()
  24. {
  25. }
  26. void update()
  27. {
  28. }
  29. void paint (Graphics& g)
  30. {
  31. // fill background
  32. g.fillAll (Colours::black);
  33. int fishLength = 15;
  34. // set the drawing colour
  35. g.setColour (Colours::white);
  36. // Create a new path object for the spine
  37. Path p;
  38. //
  39. for (int i = 0; i < fishLength; ++i)
  40. {
  41. float radius = 100 + 10 * sin (getFrameCounter() * 0.1 + i * 0.5f);
  42. float x = getWidth()/2 + 1.5f * radius * sin (getFrameCounter() * 0.02f + i * 0.12f);
  43. float y = getHeight()/2 + radius * cos (getFrameCounter() * 0.04f + i * 0.12f);
  44. // draw the ellipses of the fish
  45. g.fillEllipse(x - i, y - i, 2 + 2*i, 2 + 2*i);
  46. // start a new path at the beginning otherwise add the next point
  47. if (i == 0)
  48. p.startNewSubPath(x, y);
  49. else
  50. p.lineTo (x, y);
  51. }
  52. // stroke the path that we have created
  53. g.strokePath (p, PathStrokeType (4));
  54. }
  55. void resized()
  56. {
  57. // This is called when the MainContentComponent is resized.
  58. // If you add any child components, this is where you should
  59. // update their positions.
  60. }
  61. private:
  62. //==============================================================================
  63. // private member variables
  64. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainContentComponent)
  65. };
  66. Component* createMainContentComponent() { return new MainContentComponent(); };
  67. #endif // MAINCOMPONENT_H_INCLUDED