-
Notifications
You must be signed in to change notification settings - Fork 0
Effects
Neo Hop edited this page Jul 1, 2022
·
1 revision
- Create an effect class in the 'lib/effects' folder.
class MyEffect : public Effect {
public:
MyEffect() : Effect("Effect Menu name") { }
};- Add the effect to 'effects' list in 'lib/effects/effects.h'.
void effectsSetup() {
...
effects.add(new MyEffect());
...
}- Add persistant config variables to 'include/types.h'.
struct MyEffectConfig {
// Variables
};
struct Config {
// ...
MyEffectConfig myEffect;
};- Set default values to 'include/config.h'
Config config = {
// ...
.myEffect = {
// ...
}
};
bool resetConfig() {
config = {
// ...
.myEffect = {
// ...
}
};
// ...
}- Add config screen to the menu state machine.
class MainMenuState : public MenuScreen {
public:
MainMenuState() { }
~MainMenuState() { }
int onClick(int entryIndex) {
if (entryIndex == 2) {
switch (getConfig()->currentEffect) {
case /* myEffect index */:
return myEffectConfigScreen.index;
}
return -1;
}
};