new bg design, add navi joystick

This commit is contained in:
Armin 2026-10-02 18:33:31 +02:00
commit 48ac58555f
3 changed files with 203 additions and 80 deletions

View file

@ -18,30 +18,57 @@ public:
private:
RMX19AudioProcessor& proc;
class NavButton : public juce::Button
// one of the four wedge-shaped keys of the circular joystick ring. every wedge
// component covers the whole ring bounding box and paints only its own sector,
// so the ring centre is always at (outerR, outerR) in local coordinates.
class DirWedge : public juce::Button
{
public:
NavButton (int d, const juce::String& glyph, const juce::String& label)
: juce::Button (label), dir (d), mark (glyph)
DirWedge (const juce::String& label, double centreAngleRad)
: juce::Button (label), angle (centreAngleRad)
{ setWantsKeyboardFocus (true); setRepeatSpeed (320, 80); }
void paintButton (juce::Graphics&, bool, bool) override;
int dir;
juce::String mark;
// all four wedges share the ring's bounding box, so the box alone would let the
// topmost one swallow every click in the ring. restrict hits to this wedge's sector.
bool hitTest (int x, int y) override;
static constexpr float outerR = 66.0f;
static constexpr float innerR = 24.0f;
// half of a quadrant, minus a gap so neighbouring wedges read as separate keys
static constexpr double halfSpan = 0.7156;
double angle; // radians clockwise from 12 o'clock
};
class OkButton : public juce::Button
// the OK key sitting in the middle of the ring
class CentreOkButton : public juce::Button
{
public:
OkButton (const juce::String& label, bool isEnter)
: juce::Button (label), enter (isEnter)
{ setWantsKeyboardFocus (true); setRepeatSpeed (320, 80); }
explicit CentreOkButton (const juce::String& label) : juce::Button (label)
{ setWantsKeyboardFocus (true); }
void paintButton (juce::Graphics&, bool, bool) override;
bool enter;
// the key paints as a disc, so hit only the disc rather than its square bounds
bool hitTest (int x, int y) override;
static constexpr float radius = 21.0f;
};
NavButton* up = nullptr; NavButton* down = nullptr;
NavButton* left = nullptr; NavButton* right = nullptr;
OkButton* enterB = nullptr; OkButton* backB = nullptr;
// the separate ESC key, outside the ring at the bottom left
class EscButton : public juce::Button
{
public:
explicit EscButton (const juce::String& label) : juce::Button (label)
{ setWantsKeyboardFocus (true); }
void paintButton (juce::Graphics&, bool, bool) override;
bool hitTest (int x, int y) override;
static constexpr float diameter = 30.0f;
};
DirWedge* up = nullptr; DirWedge* down = nullptr;
DirWedge* left = nullptr; DirWedge* right = nullptr;
CentreOkButton* okB = nullptr;
EscButton* escB = nullptr;
juce::ComboBox scaleBox;
LcdPanel display;