Skip to content

Commit

Permalink
Added compatibility for j8
Browse files Browse the repository at this point in the history
  • Loading branch information
drowaudio committed Jun 13, 2024
1 parent 73ff2d8 commit 5ba7b82
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
16 changes: 16 additions & 0 deletions melatonin/blur_demo_component.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,22 @@ namespace melatonin
strokedInnerShadow.render (g, strokedInnerPath, juce::PathStrokeType (6));

g.setColour (juce::Colours::white);
#if JUCE_MAJOR_VERSION == 8
g.setFont (juce::FontOptions (50.0f, juce::Font::bold));
#else
g.setFont (juce::Font (50).boldened());
#endif
textDropShadow.render (g, "drop", textBounds, juce::Justification::left);
g.drawText ("drop", textBounds, juce::Justification::left);

g.drawText ("inner", textBounds, juce::Justification::centredRight);
textInnerShadow.render (g, "inner", textBounds.toFloat(), juce::Justification::centredRight);

#if JUCE_MAJOR_VERSION == 8
g.setFont (juce::FontOptions (16));
#else
g.setFont (juce::Font (16));
#endif
auto labels = juce::StringArray ("radius", "spread", "offsetX", "offsetY", "opacity");
for (auto i = 0; i < labels.size(); ++i)
{
Expand All @@ -164,7 +172,11 @@ namespace melatonin
auto elapsed = juce::Time::getMillisecondCounterHiRes() - start;

g.setColour (juce::Colours::white);
#if JUCE_MAJOR_VERSION == 8
g.setFont (juce::FontOptions (16));
#else
g.setFont (juce::Font (16));
#endif
g.drawText ("rendered in " + juce::String (elapsed, 3) + "ms", getLocalBounds().removeFromTop (50), juce::Justification::centred);
}

Expand Down Expand Up @@ -276,7 +288,11 @@ namespace melatonin
}

private:
#if JUCE_MAJOR_VERSION == 8
juce::Font font { juce::FontOptions ("Arial Black", 110.f, 0) };
#else
juce::Font font { "Arial Black", 110.f, 0 };
#endif
melatonin::DropShadow dropShadow {
{ juce::Colour::fromRGB (196, 181, 157), 12, { 0, 13 } },
{ juce::Colours::white, 1, { 0, -2 } }
Expand Down
4 changes: 4 additions & 0 deletions melatonin/internal/cached_shadows.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ namespace melatonin::internal
struct TextArrangement
{
juce::String text = {};
#if JUCE_MAJOR_VERSION == 8
juce::Font font { juce::FontOptions() };
#else
juce::Font font = {};
#endif
juce::Rectangle<float> area = {};
juce::Justification justification = juce::Justification::left;

Expand Down

0 comments on commit 5ba7b82

Please sign in to comment.