Prerequisites
Before building an IGraphics UI, ensure you have:Compile-time backend definition
Choose either
IGRAPHICS_NANOVG or IGRAPHICS_SKIA in your project configurationFor NanoVG, no additional dependencies are required. For Skia, you must download and build the Skia library.
The MakeGraphics Pattern
IGraphics UIs are created using the MakeGraphics pattern in your plugin constructor:Understanding mMakeGraphicsFunc
ThemMakeGraphicsFunc lambda is called to create the IGraphics instance:
*this- Reference to your plugin instancePLUG_WIDTH- Width in pixels (defined in config.h)PLUG_HEIGHT- Height in pixels (defined in config.h)PLUG_FPS- Refresh rate (typically 60)scale- Display scale factor (1.0 = 100%, 2.0 = 200%)
Understanding mLayoutFunc
ThemLayoutFunc lambda is called to create and layout controls:
Attaching Controls
Controls are attached to IGraphics and can be tagged and grouped:Control tags are user-defined integer constants. Define them as enums in your plugin header:
Linking Controls to Parameters
Controls automatically synchronize with plugin parameters:Complete Example
Here’s a full working example:MyPlugin.cpp
Enabling Features
Common features to enable in your layout function:Common Patterns
- Grid Layout
- Fractional Layout
- Dynamic Resize
Next Steps
Controls Library
Explore built-in controls
Custom Controls
Create your own widgets
Responsive UI
Handle resizing and scaling
Drawing Backends
Learn backend differences