-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCustomLookAndFeel.h
More file actions
35 lines (31 loc) · 1.15 KB
/
CustomLookAndFeel.h
File metadata and controls
35 lines (31 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#pragma once
#include <JuceHeader.h>
class CustomLookAndFeel : public juce::LookAndFeel_V4
{
public:
void drawRotarySlider(juce::Graphics& g, int x, int y, int width, int height,
float sliderPos, float rotaryStartAngle, float rotaryEndAngle, juce::Slider& slider) override
{
//Circle
auto radius = ((float)juce::jmin(width / 2, height / 2) - 4.0f) * 0.7f;
auto centreX = (float)x + (float)width * 0.5f;
auto centreY = (float)y + (float)height * 0.5f;
auto rx = centreX - radius;
auto ry = centreY - radius;
auto rw = radius * 2.0f;
auto angle = (rotaryStartAngle + sliderPos * (rotaryEndAngle - rotaryStartAngle)) - 0.2f;
g.setColour(juce::Colours::white);
g.drawEllipse(rx, ry, rw, rw, 2.0f);
//Dot
juce::Path dot;
dot.addEllipse(0.0f, -radius * 0.8f, 6.0f, 6.0f);
dot.applyTransform(juce::AffineTransform::rotation(angle).translated(centreX, centreY));
g.fillPath(dot);
}
void drawButtonBackground(juce::Graphics& g, juce::Button& button,
const juce::Colour& backgroundColour, bool isHighlighted, bool isButtonDown) override
{
juce::Rectangle<int> buttonArea = button.getLocalBounds();
g.setColour(juce::Colours::grey);
}
};