Created
January 4, 2024 19:00
-
-
Save olilarkin/c7f7c98010b10d745fb5cc8234493248 to your computer and use it in GitHub Desktop.
IPlug2 skins
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "IPlugEffect.h" | |
#include "IPlug_include_in_plug_src.h" | |
#include "IControls.h" | |
IPlugEffect::IPlugEffect(const InstanceInfo& info) | |
: Plugin(info, MakeConfig(kNumParams, kNumPresets)) | |
{ | |
GetParam(kGain)->InitDouble("Gain", 0., 0., 100.0, 0.01, "%"); | |
mMakeGraphicsFunc = [&]() { | |
return MakeGraphics(*this, PLUG_WIDTH, PLUG_HEIGHT, PLUG_FPS, GetScaleForScreen(PLUG_WIDTH, PLUG_HEIGHT)); | |
}; | |
mLayoutFunc = [&](IGraphics* pGraphics) { | |
// if controls allready exist when this layout function is called | |
// we can remove them | |
if (pGraphics->NControls()) | |
{ | |
pGraphics->RemoveAllControls(); | |
} | |
pGraphics->AttachCornerResizer(EUIResizerMode::Scale, false); | |
pGraphics->AttachPanelBackground(mSkinIndex == 0 ? COLOR_GRAY : COLOR_RED); | |
pGraphics->LoadFont("Roboto-Regular", ROBOTO_FN); | |
const IRECT b = pGraphics->GetBounds(); | |
pGraphics->AttachControl(new IVSlideSwitchControl(b.GetCentredInside(100), DefaultClickActionFunc, "Skin", DEFAULT_STYLE, false, EDirection::Horizontal, 2, mSkinIndex))->SetAnimationEndActionFunction([pGraphics, this](IControl* pCaller){ | |
this->mSkinIndex = pCaller->GetValue() > 0.5; | |
this->LayoutUI(pGraphics); | |
}); | |
}; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include "IPlug_include_in_plug_hdr.h" | |
const int kNumPresets = 1; | |
enum EParams | |
{ | |
kGain = 0, | |
kNumParams | |
}; | |
using namespace iplug; | |
using namespace igraphics; | |
class IPlugEffect final : public Plugin | |
{ | |
public: | |
IPlugEffect(const InstanceInfo& info); | |
int mSkinIndex = 0; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment