14#include "platforms/ui_defs.h"
16#define FL_NO_COPY(CLASS) \
17 CLASS(const CLASS &) = delete; \
18 CLASS &operator=(const CLASS &) = delete;
30 float max = 255,
float step = -1.f)
32 float value()
const {
return Super::value(); }
34 float min = Super::getMin();
35 float max = Super::getMax();
39 return (
value() - min) / (max - min);
41 float getMax()
const {
return Super::getMax(); }
43 operator float()
const {
return Super::value(); }
44 operator uint8_t()
const {
return static_cast<uint8_t
>(Super::value()); }
45 operator uint16_t()
const {
return static_cast<uint16_t
>(Super::value()); }
46 operator int()
const {
return static_cast<int>(Super::value()); }
47 template <
typename T> T
as()
const {
48 return static_cast<T
>(Super::value());
51 int as_int()
const {
return static_cast<int>(Super::value()); }
54 Super::setValue(
value);
58 Super::setValue(
static_cast<float>(
value));
120 bool clicked()
const {
return Super::clicked(); }
183 operator bool()
const {
return value(); }
184 explicit operator int()
const {
return static_cast<int>(
value()); }
331#define FASTLED_UI_DEFINE_OPERATORS(UI_CLASS) \
332 FASTLED_DEFINE_POD_COMPARISON_OPERATOR(UI_CLASS, >=) \
333 FASTLED_DEFINE_POD_COMPARISON_OPERATOR(UI_CLASS, <=) \
334 FASTLED_DEFINE_POD_COMPARISON_OPERATOR(UI_CLASS, >) \
335 FASTLED_DEFINE_POD_COMPARISON_OPERATOR(UI_CLASS, <) \
336 FASTLED_DEFINE_POD_COMPARISON_OPERATOR(UI_CLASS, ==) \
337 FASTLED_DEFINE_POD_COMPARISON_OPERATOR(UI_CLASS, !=)
UIButton button("Trigger")
UISlider slider("Speed", 0.18f, 0.0f, 1.0f)
static void addListener(Listener *listener, int priority=0)
static void removeListener(Listener *listener)
UIAudio(const char *name)
FL_NO_COPY(UIAudio) using Super
UIAudioImpl(const char *name)
UICheckbox & operator=(bool value)
FunctionList< UICheckbox &, bool > mCallbacks
void onChanged(function< void(bool)> callback)
void onChangedEx(function< void(UICheckbox &, bool)> callback)
bool mLastFrameValueValid
UICheckbox(const char *name, bool value=false)
UICheckboxImpl(const char *name, bool value=false)
FL_NO_COPY(UIDescription)
UIDescription(const char *name)
UIDescriptionImpl(const char *name)
UINumberField & operator=(double value)
FunctionList< UINumberField &, double > mCallbacks
UINumberField & operator=(int value)
FL_NO_COPY(UINumberField)
UINumberField(const char *name, double value, double min=0, double max=100)
bool mLastFrameValueValid
void onChanged(function< void(double)> callback)
void setValue(double value)
void onChangedEx(function< void(UINumberField &, double)> callback)
UINumberFieldImpl(const char *name, double value, double min=0, double max=100)
void setValue(double value)
bool mLastFramevalueValid
FunctionList< UISlider &, float > mCallbacks
UISlider & operator=(int value)
UISlider(const char *name, float value=128.0f, float min=1, float max=255, float step=-1.f)
FL_NO_COPY(UISlider) using Super
int onChanged(function< void(float)> callback)
void setValue(float value)
int onChangedEx(function< void(UISlider &, float)> callback)
UISlider & operator=(float value)
float value_normalized() const
UISliderImpl(const char *name, float value=128.0f, float min=1, float max=255, float step=-1.f)
UITitle(const char *name)
UITitleImpl(const char *name)
#define ALMOST_EQUAL(a, b, small)
Implements the FastLED namespace macros.
Implements a simple red square effect for 2D LED grids.
void onBeginFrame() override
Listener(UICheckbox *owner)
void addToEngineEventsOnce()
Listener(UINumberField *owner)
void addToEngineEventsOnce()
void onBeginFrame() override
void addToEngineEventsOnce()
void onBeginFrame() override
Listener(UISlider *owner)
#define FASTLED_UI_DEFINE_OPERATORS(UI_CLASS)
#define FASTLED_UNUSED(x)