MCPcopy Create free account
hub / github.com/TheWaveWarden/odin2 / paint

Method paint

Source/gui/ModAmountComponent.cpp:27–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25}
26
27void ModAmountComponent::paint(Graphics &g) {
28 SET_INTERPOLATION_QUALITY(g)
29
30 auto bounds = getLocalBounds().toFloat();
31 const auto corner = float(getHeight()) * 0.1f;
32
33 const auto scaleCompensation = float(ConfigFileManager::getInstance().getOptionGuiScale()) / float(GuiScale::Z200);
34 juce::BorderSize<float> border_size(3.0f * scaleCompensation, 3.0f * scaleCompensation, 1.0f * scaleCompensation, 2.0f * scaleCompensation);
35 border_size.subtractFrom(bounds);
36
37 if (m_value > 0) {
38 g.setColour(m_color_bar.withAlpha(0.3f));
39 bounds = bounds.removeFromLeft(bounds.proportionOfWidth(m_value));
40 g.fillRoundedRectangle(bounds, corner);
41 } else if (m_value < 0) {
42 g.setColour(m_color_bar_negative.withAlpha(0.3f));
43 bounds = bounds.removeFromRight(bounds.proportionOfWidth(-m_value));
44 g.fillRoundedRectangle(bounds, corner);
45 }
46
47 g.setFont(Helpers::getAldrichFont(H / 1.8f));
48 g.setColour(COL_TEXT_BLUE);
49 g.drawText(juce::String(juce::roundToInt(m_value * 100.0f)), getLocalBounds(), Justification::centred, true);
50}
51
52void ModAmountComponent::mouseDrag(const MouseEvent &event) {
53 float drag_scalar = H * 0.0002f;

Callers

nothing calls this directly

Calls 1

getOptionGuiScaleMethod · 0.80

Tested by

no test coverage detected