struct mola::gui::LiveFloat
Overview
A float value that can be written from any thread and polled by the GUI thread each frame. Used to drive slider positions from module logic without requiring the user to drag the slider.
Usage (writer side, any thread): liveFloat.set(static_cast<float>(currentStep));
Usage (GUI thread, ImGui backend): float v = liveFloat.poll(); // returns current value, clears dirty flag
#include <GuiWidgetDescription.h> struct LiveFloat { // typedefs typedef std::shared_ptr<LiveFloat> Ptr; // construction LiveFloat(); LiveFloat(float initial); LiveFloat(const LiveFloat&); LiveFloat(LiveFloat&&); // methods LiveFloat& operator = (const LiveFloat&); LiveFloat& operator = (LiveFloat&&); void set(float v); float poll(); bool dirty() const; };
Methods
void set(float v)
Write from any thread.
float poll()
Call from the GUI thread. Returns the pending value and clears the dirty flag. If not dirty, returns the last polled value unchanged.