#pragma once #include "modules/meta.hpp" LEMONBUDDY_NS using namespace drawtypes; namespace modules { class counter_module : public timer_module { public: using timer_module::timer_module; void setup() { m_interval = chrono::duration(m_conf.get(name(), "interval", 1)); m_formatter->add(DEFAULT_FORMAT, TAG_COUNTER, {TAG_COUNTER}); } bool update() { m_counter++; return true; } bool build(builder* builder, string tag) { if (tag == TAG_COUNTER) { builder->node(to_string(m_counter)); return true; } return false; } private: static constexpr auto TAG_COUNTER = ""; int m_counter{0}; }; } LEMONBUDDY_NS_END