Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update the doc a bit
Browse files Browse the repository at this point in the history
baconpaul committed May 27, 2024

Verified

This commit was signed with the committer’s verified signature.
snyk-bot Snyk bot
1 parent a59e6a2 commit e781399
Showing 2 changed files with 23 additions and 14 deletions.
21 changes: 21 additions & 0 deletions include/sst/jucegui/components/GlyphPainter.h
Original file line number Diff line number Diff line change
@@ -30,6 +30,27 @@ struct GlyphPainter : public juce::Component,
public style::StyleConsumer,
public style::SettingsConsumer
{
/*
* GlyphPainter provides a funciton which draws a glpyh into
* a box in a color. It's both a component and a static function
* to do the draw you can use in other contexts.
*
* The glyphs are enumerated below. To add a glyph you add to
* that enum then draw it in the switch in GlyphPainter.cpp.
*
* Theres two strategies for the glyphs
*
* 1. Just paint them. Write code in GlpyhPainter.cpp with draw and
* stuff.
* 2. Use an SVG. To add one with an SVG
* a. Add the svg to `res/glyphs/blah.svg`
* b. Add that svg to the CMakeLists in the cmrc_add_resource_librar
* c. In the GlpyhPainter handle the switch case to delegate by
* path.
* FOr now you have to specify the base color and size of the SVG,
* since the JUCE APIs to get these aren't super reliable. But really
* they are all 24x24 0xFFAFAFAF in the Figma so it's just copy and paste
*/
enum GlyphType
{
PAN,
16 changes: 2 additions & 14 deletions src/sst/jucegui/components/GlyphPainter.cpp
Original file line number Diff line number Diff line change
@@ -278,18 +278,6 @@ void paintFromSvg(juce::Graphics &g, const juce::Rectangle<int> &into, const std
}
}

static void paintStepCountGlyph(juce::Graphics &g, const juce::Rectangle<int> &into,
const juce::Colour &c)
{
paintFromSvg(g, into, "res/glyphs/step_count.svg", 0xFFAFAFAF, 24, 24, c);
}

static void paintMetronomeGlyph(juce::Graphics &g, const juce::Rectangle<int> &into,
const juce::Colour &c)
{
paintFromSvg(g, into, "res/glyphs/metronome.svg", 0xFFAFAFAF, 24, 24, c);
}

void paintStereoGlyph(juce::Graphics &g, const juce::Rectangle<int> &into)
{
auto rad = std::min(into.getWidth(), into.getHeight()) * 0.8 * 0.5;
@@ -357,7 +345,7 @@ void GlyphPainter::paintGlyph(juce::Graphics &g, const juce::Rectangle<int> &int
return;

case METRONOME:
paintMetronomeGlyph(g, into, as);
paintFromSvg(g, into, "res/glyphs/metronome.svg", 0xFFAFAFAF, 24, 24, as);
return;

case KEYBOARD:
@@ -373,7 +361,7 @@ void GlyphPainter::paintGlyph(juce::Graphics &g, const juce::Rectangle<int> &int
return;

case STEP_COUNT:
paintStepCountGlyph(g, into, as);
paintFromSvg(g, into, "res/glyphs/step_count.svg", 0xFFAFAFAF, 24, 24, as);
return;

default:

0 comments on commit e781399

Please sign in to comment.