pitrix/include/effects.h
Fabian Schlenz a6af2829ee Better and more SimpleEffects.
* Calculations are done using doubles for much easier code.
* Binary flags instead of boolean variables for configuration.
* New effects sineline, barbershop and zigzag.
2020-11-06 22:33:37 +00:00

29 lines
753 B
C++

#pragma once
#include "Effect.h"
#include "effects/clock.h"
#include "effects/timer.h"
#define SIMPLE_EFFECT(name, use_in_cycle, flags, ...) {name, use_in_cycle, [](){ return new SimpleEffect(name, flags, [](double t, uint16_t i, uint8_t x, uint8_t y)->double __VA_ARGS__ ); }}
struct EffectEntry {
const char* name;
bool use_in_cycle;
std::function<Effect*()> create;
#ifdef MQTT_REPORT_METRICS
int16_t heap_change_sum;
uint16_t run_count;
#endif
};
extern EffectEntry effects[];
extern const uint8_t effects_size;
extern Effect* current_effect;
extern ClockEffect effect_clock;
extern TimerEffect effect_timer;
Effect* select_effect(char* name);
Effect* select_effect(uint8_t id);
bool change_current_effect(String s);
void setup_effects();